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.
Author |
Topic |
Kinnerton
Starting Member
21 Posts |
Posted - 2012-03-02 : 05:33:07
|
Hi,(On SQL 2005 Standard)I'm trying to delete chunks of old data from a large logging table. Following excellent advice from these forums, I am deleting in chunks with row-locking. This seems to going fine.The weird thing is that I've deleted around 30 million rows (approx 30Gb) and there has been a consistent growth being reported by sp_spaceused.Granted, there is data being added - but nowhere near as much as I've taken out.Has anyone any ideas what's happening?Oh, yes. Statistics have been refreshed.Cheers,Kinnerton |
|
Kinnerton
Starting Member
21 Posts |
Posted - 2012-03-02 : 05:44:54
|
I've just come across : http://support.microsoft.com/kb/913399It says that a heap table delete doesn't release until a tablock occurs. I'm using rowlocking for my deletion script, does anyone know if running the code with a tablock (out-of-production-hours) will release the space I've already deleted?Thanks. |
|
|
Kinnerton
Starting Member
21 Posts |
Posted - 2012-03-06 : 08:21:41
|
Is it a dumb question? Or does nobody know? :) |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2012-03-06 : 11:40:20
|
I don't think the db will decrease at all automatically. (Depending on autogrow settings).the engine figures that if the table were that big before it will be again so why move shit around.I'm not sure though.Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
|
|
X002548
Not Just a Number
15586 Posts |
|
Kinnerton
Starting Member
21 Posts |
Posted - 2012-03-16 : 05:28:08
|
Hi,Thanks for the responses.I'm not trying to reduce the physical footprint of the DB - as you say, that would be a pointless exercise. I'm trying to reduce reserved space from a massive logging table (deleting 6 month+ data) for other tables to use.I'm in full recovery model.Cheers,Kinnerton |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2012-03-16 : 05:54:18
|
Wait until ghost clean up has finished. N 56°04'39.26"E 12°55'05.63" |
|
|
|
|
|
|
|