TSQL: which type of real number leads to faster comparisons

TSQL (MSSQL) types include real, float, and decimal; which type will lead to faster comparisons?

Will decimal use of FPU calculations from hardaware or is it purely in software?

+3


source to share


2 answers


Decimal numbers cannot use FPU. You get better performance with float or real, which maps to the IEEE standard floating point number that the FPU supports.

float = double real = single



Of course, the single is faster.

+1


source


Are these relative comparisons>, <or equality comparisons = ,! =?

Floats and reals are approximation data types where there is an actual representation as a decimal number. If you're doing equality, you'll want to stay away from floats and reals. So this leaves decimal places.



Most likely SQL Server will not go to FPU for comparative comparisons. FPU and other coprocessors are used for arithmetic.

0


source







All Articles