Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Worth recycling records in SQL Server
Message
From
12/08/2019 18:16:57
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., New Zealand
 
General information
Forum:
Microsoft SQL Server
Category:
Database design
Miscellaneous
Thread ID:
01670046
Message ID:
01670047
Views:
81
>> Does SQL Server recycle records on its own? Or do you think it is still worth recycling the records in the SQL Server table?

Last time I checked: SQL Server initially marks a deleted record as de-allocated. Then a "Ghost cleanup" wakes every few seconds to check for resulting ghost records and free-up space. It limits itself to a few pages at a time to avoid swamping the system so if you delete (say) 10000 records the ghost records might be freed up over some seconds or minutes.

Short answer is that usually there's not much to gain from rolling your own record recycling.

Some people also advocate regularly Shrinking the database- but Shrink is NOT equivalent to Pack. Shrink can eliminate unused pages but won't free deleted record space if the page is still in use by other records. There's also argument re situations where Shrink is a bad idea- worth a quick internet search.
"... They ne'er cared for us
yet: suffer us to famish, and their store-houses
crammed with grain; make edicts for usury, to
support usurers; repeal daily any wholesome act
established against the rich, and provide more
piercing statutes daily, to chain up and restrain
the poor. If the wars eat us not up, they will; and
there's all the love they bear us.
"
-- Shakespeare: Coriolanus, Act 1, scene 1
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform