|
|
|
SSC 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 !
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 3:58 PM
Points: 32,899,
Visits: 26,780
|
|
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."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, October 18, 2012 8:41 AM
Points: 27,
Visits: 76
|
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Today @ 8:35 AM
Points: 4,418,
Visits: 7,173
|
|
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
|
|
|
|