What datatype is the most efficient to store a number such as 11.111.
The numbers will have up 2 digits before the point and up to three after.
Currently the column is a ‘bigint’, I am guessing that this will need to be changed to a decimal or a float.
Any help much appreciated.
thanks
Bigint is an integer datatype, so yeah, that won’t work without some preprocessing footwork. Do you need to store the values precisely, or only approximately? The binary floating point types (
float,real) are efficient and compact, but don’t represent many decimal values exactly, and so comparisons won’t always give you what you expect, and errors accumulate.decimalis a good bet. A decimal of precision 5 and scale 3 (meeting your requirements) consumes five bytes.See documentation on the decimal datatype here, and datatypes in general here.