Question

Among TSQL types (MSSQL): real, float and decimal; which type would result in faster comparisons?

Would decimal use hardaware FPU computation or is it purely in software?

Was it helpful?

Solution

Decimals cannot use the FPU. You get best performance with float or real which map to a standard IEEE floating point number which is supported by the FPU.

float = double real = single

Of course, single is faster.

OTHER TIPS

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

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

More than likely, SQL Server won't go to the FPU for relative comparisons. FPU and other coprocessors are used for arithmetic.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top