patternMinor
SQL Database size doesn't match with the total table sizes in the database
Viewed 0 times
totalthesqlsizewithmatchdatabasesizesdoesntable
Problem
I have a database that is size about 104GB.
When I calculate the total table sizes in the database it's only about 24GB. This includes Data+index+unused spaces.
Why the DB size is too large?
When I calculate the total table sizes in the database it's only about 24GB. This includes Data+index+unused spaces.
Why the DB size is too large?
Solution
Depending on the RDBMS being used, it is possible that the large file size as compared to summed-up table sizes is caused by any or more than one of the following:
-
Last database cleanup (in terms of table deletion, record deletion, etc) did not affect any disk reclamation by the OS/RDBMS
-
Last database cleanup does not normally affect disk space reclamation by OS/RDBMS
-
Indexes/constraints are being stored in other files. You won't see these when checking just table sizes.
-
No shrinking has been performed, though that may also possibly end up as first and/or second in this list
-
A possible miscalculation of table size retrieval (I just need to add this because it happens to some) and so the numbers don't tally
-
And maybe a few others.. Hopefully the stackers can add
I'm not saying these are definite items that impact your situation. I just mean that these may occur, and not just in your situation..
-
Last database cleanup (in terms of table deletion, record deletion, etc) did not affect any disk reclamation by the OS/RDBMS
-
Last database cleanup does not normally affect disk space reclamation by OS/RDBMS
-
Indexes/constraints are being stored in other files. You won't see these when checking just table sizes.
-
No shrinking has been performed, though that may also possibly end up as first and/or second in this list
-
A possible miscalculation of table size retrieval (I just need to add this because it happens to some) and so the numbers don't tally
-
And maybe a few others.. Hopefully the stackers can add
I'm not saying these are definite items that impact your situation. I just mean that these may occur, and not just in your situation..
- One other thing. It can also depend on the database settings for new disk allocation sizes. Say for example one allocation for a certain DB is 1GB. Once the usage exceeds that, another 1GB is added, regardless of whether or not you consumed all of it -- at the moment more allocation is required, it gets set.
Context
StackExchange Database Administrators Q#9623, answer score: 3
Revisions (0)
No revisions yet.