11.8 Choose the right type for the column

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 1to 99999a value between, it MEDIUMINT UNSIGNEDis the most suitable type. Among the types that represent all required values, this type uses the least storage space.

All with DECIMALthe basic calculated column ( +, -, *and /) are in 65bit decimal ( 10radix) digital complete accuracy. See 11.1.1 Numerical Data Type Syntax .

If accuracy is not very important, or speed is the most important, DOUBLEtype may be sufficient. In order to obtain high accuracy, you can always convert it to BIGINTa fixed-point type stored in . This enables you to use 64bit integers for all calculations and then convert the results back to floating point values ​​as needed.

Guess you like

Origin blog.csdn.net/wb1046329430/article/details/114821315