Sql-server – Size of the database and table while inserting and deleting in sql server 2005

sql-server-2005

I have created a table : Table1. Inserted 100 thousand rows and deleted. I did the same around 100 times ( inserting and deleting). Will it cause of increasing the database and table size every time? ( I am using Delete instead of Truncate).

Best Answer

WHen you use delete the rows actually not deleted but marked as GHOST records, which will finally deleted by dedicated process named GHOST CLEANUP which works relatively slow in background

To force deletion of ghost records run:

DBCC FORCEGHOSTCLEANUP