Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where has all the space disappeared?

Status
Not open for further replies.

NemoMaximus

Programmer
Mar 7, 2007
12
SE
I'm running SQL Server 2005 and one of my databases is eating up space and I have no idea why... My calculations of the required space is just not saying the same thing as the SQL Server reports. Have a look at this:

EXEC sp_spaceused MyTableName

Returns
-------
Name = MyTableName
Rows = 14674175
Reserved = 22898464 KB
Data = 18169480 KB
Index_size = 4669704 KB
Unused = 59280 KB

Now, have a look at the table structure:

field_01 Type=uniqueidentifier Length=16
field_02 Type=uniqueidentifier Length=16
field_03 Type=uniqueidentifier Length=16
field_04 Type=datetime Length=8
field_05 Type=datetime Length=8
field_06 Type=numeric Length=13
field_07 Type=char Length=1
field_08 Type=char Length=1
field_09 Type=char Length=3
field_10 Type=char Length=1
field_11 Type=char Length=1
field_12 Type=numeric Length=5
field_13 Type=numeric Length=13
field_14 Type=char Length=1
field_15 Type=bit Length=1
field_16 Type=timestamp Length=8
field_17 Type=_deduction numeric Length=13
field_18 Type=_deducted char Length=1
field_19 Type=char Length=3
field_20 Type=numeric Length=5
field_21 Type=numeric Length=13
field_22 Type=numeric Length=13
field_23 Type=numeric Length=13
field_24 Type=int Length=4
field_25 Type=numeric Length=5
field_26 Type=numeric Length=13

Total length = 195 bytes

So according to my calculations the space used for the table should be:

14674175 x 195 = 2,861,464,125 bytes or 2,861,464 KB

But sp_spaceused is reporting the the space used is 18,169,480 KB, more than 6 times what it should be according to my calculations. How is this possible?

One thought that I have... I'm deleting about 700000 of these records every day and recalculates them. Could it be that the deleted records are still there taking up space? And if so, how do I get rid of them?

Please help :)
 
FYI... I had no problem at all upgrading from SP2 CTP to SP2a :) Its going to be interesting to see if this changes the behavior of my table growth...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top