Search code examples
sql-serversql-server-2008database-designtypesdata-warehouse

SQL Server: what data type for decimal measure values?


When building data marts for reporting purposes (using dimensional modelling), what data types should I use for decimal measure values (for fast operations)? Numeric, decimal or money?


Solution

  • Numeric = Decimal. Different name, same data type. As for money, see this interesting test done by Aaron Bertrand
    https://sqlblog.org/2008/04/27/performance-storage-comparisons-money-vs-decimal

    The long and short is that decimal is faster (marginally) than money and more flexible; money is really only meant for currency and is locked to 4dp. If you are modeling and floating point maths is acceptable, consider floating-point maths using float/real, which is native on the CPU (there are floating point registers, but not decimal). Floats are always faster than decimals.