Is there a speed difference in ordering by int vs. float?
问题 When retrieving entries in a database, is there a difference between storing values as a float or decimal vs. an int when using ORDERBY in a SELECT statement? 回答1: It depends. You didn't specify the RDBMS so I can only speak to SQL Server specifically but data types have different storage costs associated with them. Ints range from 1 to 8 bytes, Decimals are 5-17 and floats are 4 to 8 bytes. The RDBMS will need to read data pages off disk to find your data (worst case) and they can only fit