Pergunta

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?

Foi útil?

Solução

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.

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top