Similar to varchar that stores strings of varying length, is there an alternative for numbers of varying length that allocates space depending on the size of the number?
I have a large table with 50 columns holding about a billion rows including 15 numeric(10) columns. My quick proof of concept with 4 million showed that I can save a bit of disk-space by reducing the size of these 15 columns, hence this question. Please advise.
POC details - I reduced the column size from numeric(22) to numeric(5) for 15 columns with 3.5 mil rows and disk usage dropped from 1398.02 MB to 981.23 MB.
I will have to push this up to numeric(10) as size 5 will not suffice.
Note: numeric(22) was a bad design I inherited. Changing to integer data type reduced disk usage even further - 907.27 MB. Integer should help if our data model standards team allows this [since it contains no precision]. Will keep posted.
The server version and edition is
Microsoft SQL Server 2014 (SP2) (KB3171021) - 12.0.5000.0 (X64) Jun 17 2016 19:14:09 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows NT 6.3 (Build 9600: ) (Hypervisor)