Skip to main content
Question

INTEGER vs FLOAT performance

  • December 10, 2019
  • 2 replies
  • 17 views

Bryan_H
Forum|alt.badge.img+2

We have a customer with a question on INTEGER vs FLOAT performance. They have 170 fields FLOAT but some of them could be converted to INTEGER. Would they expect better performance by converting FLOAT to INTEGER where possible? That is, will compression improve, will order by and group by show any benefit? They would like some advice since the table is >10B rows, some of the FLOAT are in the projection order and group, so conversion and projection refresh will take a long time, and the docs don't comment much on how number types (INTEGER, FLOAT, NUMERIC) are handled internally, but other DBMS comment that FLOAT is a large data type so it is implicitly takes longer to load and process.

2 replies

skeswani
Forum|alt.badge.img
  • Participating Frequently
  • December 10, 2019

If you can use INT instead of float/numeric you should.
The benefits are hard to quantify and are in some cases the benefits maybe marginal. here is some of the info on size
https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/SQLReferenceManual/DataTypes/SQLDataTypes.htm


marcothesane
Forum|alt.badge.img+1
  • Participating Frequently
  • December 10, 2019

A hint as to why might be:
The 64bit Integer is the fastest data type in both 64bit Linux and Vertica. It takes just one cycle to compare, add, subtract two integers. Even if a DOUBLE/FLOAT also only takes up 8 bytes, you often need several cycles to do the same. You will see that in SUM() , in ORDER BY, in WHERE conditions and in all similar situations.