Answer recommended by moderator
Hi Rama Krishna,
Reason for Excessive Storage
NUMERIC(18,0) only requires 9 bytes per row. For 45 million rows, it should occupy <1 GB.
If itβs showing 5,755 GB, likely causes include:
- Severe fragmentation or page bloat (especially since itβs a clustered PK).
- Ghost records / versioning if snapshot isolation is enabled.
- Database corruption or incorrect storage reporting.
Steps to Fix
- Check fragmentation & table size:
EXEC sp_spaceused 'tblAudit';
- Rebuild the clustered index:
ALTER INDEX PK_tblAudit_ID ON tblAudit REBUILD;
Consider setting an appropriate FILLFACTOR if there are many inserts.
- Verify database integrity:
DBCC CHECKDB('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;
- Review the data type:
If ID fits within BIGINT range, consider changing from NUMERIC(18,0) β BIGINT to reduce storage per row.
