Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Table Space Query - data and index size

Posted on 2010-09-20
8
676 Views
Last Modified: 2012-08-13
Hi All,

I have a n SQL Server 2000 database which has data imported each night into it.

The import has been failing for the past few nights so I am investigating as to why.

Now I have noticed that when I use the SPROC sp_spaceused to check the tables for size, I have 2 tables that currently contain 0 rows but the space used shows as:

Table 1
Data: 109264 KB
index_size: 11360 KB

Table 2
Data: 8988288 KB
index_size: 28880 KB

Both tables have primary keys and auto increment set and each night these tables are truncated before new data is inserted. But at the moment these tables are empty.

Can anyone advise why there would be so much data still attached to these tables even though there isn't any rows?

Thanks,

Rit
0
Comment
Question by:rito1
  • 4
  • 2
  • 2
8 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 33715384
is there a clustered index on the table?
if not, that might explain why the "reserved" space for the table is not released...
0
 
LVL 1

Author Comment

by:rito1
ID: 33715425
The index is clustered.?
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 33715562
is that a question or a affirmation?
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 1

Author Comment

by:rito1
ID: 33715655
Hi angelIII,

Sorry just confused still... my tables have a clustered index on the primary key. So I am still looking into as to why the data still appears so big when there is physically no data in it.

Thanks for your help.

Rit
0
 
LVL 23

Expert Comment

by:Racim BOUDJAKDJI
ID: 33715753
Instead of truncating the table, I'd suggest recreating them then inserting...
0
 
LVL 23

Assisted Solution

by:Racim BOUDJAKDJI
Racim BOUDJAKDJI earned 250 total points
ID: 33715771
Also please activate instant file initialization.  SQL Server space allocation/deallocation can be quite tricky...instant file initialization makes the process less painful.  eventually think of rebuilding the index (dbcc reindex) at the end of the import...
0
 
LVL 1

Author Comment

by:rito1
ID: 33715794
Hi Both,

I have just appended True at the end of my sp_spaceused SPROC and it shows the real statistic rather than a cached version... these stats look a lot better. Thanks for you help anyway.

Rit
0
 
LVL 1

Author Comment

by:rito1
ID: 33715811
Hi,

I just tried to award the points but it seems to have tried to close the question.. is this correct?

Rit
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how the fundamental information of how to create a table.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question