Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 compress table

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2007-08-23 : 03:53:53
i have a table that is often deleted from and added to.
i noticed that it gets realy slow -

is there a way to compress a table? (there must be even in access you can compact and repair)

is there sql code that I can call from my code after doing a lot of deleting to speak this up.

Please advise.

mobasha
Starting Member

45 Posts

Posted - 2007-08-23 : 09:16:41
i dont know if this solution is good for ur case but u can put the data in other table , then truncate the original one and then insert the transfaired data to the table again.

MobashA
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-23 : 22:46:52
You should rebuild clustered index in the table.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-09-03 : 14:33:20
MS Access "Compact and Repair" does not compact the table! All it just do is to clean up the records marked/flagged as deleted and defrag the records internally in the file.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-09-04 : 04:08:35
Worth reindexing (or defragmenting) any non-clustered indexes too.

Kristen
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-09-04 : 04:09:16
(And Update the Statistics if you do a Defrag, plus update the statistics if you are NOT doing an Index Rebuild regularly)
Go to Top of Page
   

- Advertisement -