Official document address: 11.8 Choosing the Right Type for a Column
For the best storage, you should try to use the most precise type in all situations. For example, if an integer column is used 1
to 99999
a value between, it MEDIUMINT UNSIGNED
is the most suitable type. Among the types that represent all required values, this type uses the least storage space.
All with DECIMAL
the basic calculated column ( +
, -
, *
and /
) are in 65
bit decimal ( 10
radix) digital complete accuracy. See 11.1.1 Numerical Data Type Syntax .
If accuracy is not very important, or speed is the most important, DOUBLE
type may be sufficient. In order to obtain high accuracy, you can always convert it to BIGINT
a fixed-point type stored in . This enables you to use 64
bit integers for all calculations and then convert the results back to floating point values as needed.