Our SQL Server 2000 database .mdf
file is 27Gb large which seems much larger than is plausible. Using the following query we tried to analyse table sizes:
select cast(object_name(id) as varchar(50)) AS name,
sum(CASE WHEN indid<2 THEN rows END) AS rows,
sum(reserved)*8 AS reserved,
sum(dpages)*8 AS data,
sum(used-dpages)*8 AS index_size,
sum(reserved-used)*8 AS unused
from sysindexes with (nolock)
where indid in(0,1,255) and id>100
GROUP BY id with rollup
ORDER BY sum(reserved)*8 desc
The results were as follows:
Name Rows Reserved Data Index_Size Unused
NULL 15274279 26645456 5674592 17361464 3609400
BigTable 875966 16789712 471096 13349816 2968800
- How can we find out which objects are causing this massive
NULL
space usage? - It seems that approx 26GB are "reserved" for
NULL
, 16GB forBigTable
- is this basically a waste of space or are real records involved?
select id, reserved from sysindexes order by reserved desc;
yield? AlsoBigTable
seems to have 13 GB worth of indexes, so I wonder about your definition of "waste of space"...