Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Getting space back after manually deleting records Expand / Collapse
Author
Message
Posted Tuesday, October 16, 2012 12:45 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, October 18, 2012 8:41 AM
Points: 27, Visits: 76
We have a database with lab tests that we are going to merge with a different database. The original has 8,000,000 records. The new one can only bring in 100,000 at a time. I am copying the database, then deleting down to 100,000 records. However, the space on disk remains the same. Do I need to pack the database somehow to regain the space ?

Thanx !
Post #1373473
Posted Tuesday, October 16, 2012 4:09 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 8:06 PM
Points: 36,786, Visits: 31,243
chilidogie (10/16/2012)
We have a database with lab tests that we are going to merge with a different database. The original has 8,000,000 records. The new one can only bring in 100,000 at a time. I am copying the database, then deleting down to 100,000 records. However, the space on disk remains the same. Do I need to pack the database somehow to regain the space ?

Thanx !


Yes. Rebuild the clustered index to recover the table space and rebuild the non-clustered indexes to regain the index space.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1373565
Posted Thursday, October 18, 2012 8:48 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, October 18, 2012 8:41 AM
Points: 27, Visits: 76
Thanx Greatly !!!!
Post #1374416
Posted Friday, October 19, 2012 1:33 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:47 AM
Points: 5,233, Visits: 9,476
If you want to release space on disk then you need to shrink the database. See DBCC SHRINKDATABASE. Beware, though - if your database is likely to grow again then you're wasting resources by shrinking it, as well as causing internal and external fragmentation.

John
Post #1374665
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse