Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Article Discussions
»
Article Discussions by Author
»
Discuss content posted by Wayne Sheffield
»
Ghost Cleanup
31 posts, Page 2 of 4
««
1
2
3
4
»
»»
Ghost Cleanup
Rate Topic
Display Mode
Topic Options
Author
Message
Stewart "Arturius" Campbell
Stewart "Arturius" Campbell
Posted Tuesday, January 15, 2013 5:21 AM
Hall of Fame
Group: General Forum Members
Last Login: Today @ 3:48 AM
Points: 3,125,
Visits: 4,311
Good question, thanks Wayne
Had to dust off the old plates for this one...
____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Post #1407191
paul.knibbs
paul.knibbs
Posted Tuesday, January 15, 2013 6:06 AM
Ten Centuries
Group: General Forum Members
Last Login: Today @ 3:43 AM
Points: 1,257,
Visits: 4,255
okbangas (1/15/2013)
But, there has not been any scan between the marking of ghost records and Ghost Cleanup Task, hence it has nothing to do.
I think that's a scan that's carried out by the ghost cleanup task itself, not a random scan that's done as part of a SELECT statement. May be wrong on that, but that's how I read it!
Post #1407211
mtassin
mtassin
Posted Tuesday, January 15, 2013 6:52 AM
Hall of Fame
Group: General Forum Members
Last Login: Today @ 4:40 PM
Points: 3,226,
Visits: 64,134
Good question Wayne. Thanks!
--Mark Tassin
MCITP - SQL Server DBA
Proud member of the Anti-RBAR alliance.
For help with Performance click this link
For tips on how to post your problems
Post #1407250
DugyC
DugyC
Posted Tuesday, January 15, 2013 7:06 AM
Ten Centuries
Group: General Forum Members
Last Login: Today @ 1:28 AM
Points: 1,161,
Visits: 727
paul.knibbs (1/15/2013)
okbangas (1/15/2013)
But, there has not been any scan between the marking of ghost records and Ghost Cleanup Task, hence it has nothing to do.
I think that's a scan that's carried out by the ghost cleanup task itself, not a random scan that's done as part of a SELECT statement. May be wrong on that, but that's how I read it!
+1
Great question Wayne, thanks.
_____________________________________________________________________
"The difficult tasks we do immediately, the impossible takes a little longer"
Post #1407260
Mighty
Mighty
Posted Tuesday, January 15, 2013 7:53 AM
SSCrazy
Group: General Forum Members
Last Login: Today @ 3:22 AM
Points: 2,717,
Visits: 982
okbangas (1/15/2013)
As far as I understand it, there is something missing from the explanation. If we assume that only what's written in the scenario has happened, the scenario is as follows:
* Table is created
* Records are inserted
* Records are deleted -> Marked as ghost
* Ghost Cleanup Task is running (every 5 seconds).
But, there has not been any scan between the marking of ghost records and Ghost Cleanup Task, hence it has nothing to do.
I agree with you that in this scenario the scan was not done, so nothing was done, but that is not relevant for the explanation: the page will
never
be completely deleted by the Ghost Cleanup Task, even if it would have been scanned before. As far as I can see that was the important lesson to be learned here.
Post #1407276
WayneS
WayneS
Posted Tuesday, January 15, 2013 8:07 AM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 2:02 PM
Points: 6,367,
Visits: 8,228
okbangas (1/15/2013)
As far as I understand it, there is something missing from the explanation. If we assume that only what's written in the scenario has happened, the scenario is as follows:
* Table is created
* Records are inserted
* Records are deleted -> Marked as ghost
* Ghost Cleanup Task is running (every 5 seconds).
But, there has not been any scan between the marking of ghost records and Ghost Cleanup Task, hence it has nothing to do.
The ghost cleanup task doesn't just start up when it's told to – it starts up in the background every 5 seconds and looks for ghost records to cleanup. Remember that it won't be told to go cleanup a specific page by a delete operation – it's a subsequent scan that does it, if a scan happens.
http://www.sqlskills.com/blogs/paul/inside-the-storage-engine-ghost-cleanup-in-depth/
You're absolutely correct. However, the question states:
If you delete the first 12 records, how many data pages will the table have
after
the Ghost Cleanup process has been run against this table?
It's not going to run against this table until something scans this table, but once it does, it will leave that page with only one record in it.
Wayne
Microsoft Certified Master: SQL Server 2008
If you can't explain to another person how the code that you're copying from the internet works, then
DON'T USE IT
on a production system! After all,
you
will be the one supporting it!
Links:
For better assistance in answering your questions
,
How to ask a question
,
Performance Problems
,
Common date/time routines
,
CROSS-TABS and PIVOT tables Part 1
&
Part 2
,
Using APPLY Part 1
&
Part 2
,
Splitting Delimited Strings
Post #1407283
IgorMi
IgorMi
Posted Tuesday, January 15, 2013 8:18 AM
SSCommitted
Group: General Forum Members
Last Login: Today @ 1:57 PM
Points: 1,875,
Visits: 1,439
Hi,
Interesting question!
The expected one data page will be listed after rebuilding the index on the table.
alter index PK_Test on dbo.Test rebuild
dbcc ind ('TestDB','Test',1)
Thanks,
IgorMi
Post #1407288
WayneS
WayneS
Posted Tuesday, January 15, 2013 8:35 AM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 2:02 PM
Points: 6,367,
Visits: 8,228
IgorMi (1/15/2013)
Hi,
Interesting question!
The expected one data page will be listed after rebuilding the index on the table.
alter index PK_Test on dbo.Test rebuild
dbcc ind ('TestDB','Test',1)
Thanks,
IgorMi
Absolutely correct (and this was pointed out in the demonstration example on my blog at
http://blog.waynesheffield.com/wayne/archive/2012/12/ghost-cleanup-process/
)
Wayne
Microsoft Certified Master: SQL Server 2008
If you can't explain to another person how the code that you're copying from the internet works, then
DON'T USE IT
on a production system! After all,
you
will be the one supporting it!
Links:
For better assistance in answering your questions
,
How to ask a question
,
Performance Problems
,
Common date/time routines
,
CROSS-TABS and PIVOT tables Part 1
&
Part 2
,
Using APPLY Part 1
&
Part 2
,
Splitting Delimited Strings
Post #1407301
Sean Lange
Sean Lange
Posted Tuesday, January 15, 2013 8:50 AM
SSCrazy Eights
Group: General Forum Members
Last Login: Today @ 2:45 PM
Points: 8,567,
Visits: 8,218
Great question Wayne. I knew the page would not be deallocated but I didn't know all of the details. The article was very interesting and informative read.
I wonder if Celko will start bashing Paul Randal for calling them records instead of rows??
_______________________________________________________________
Need help? Help us help you.
Read the article at
http://www.sqlservercentral.com/articles/Best+Practices/61537/
for best practices on asking questions.
Need to split a string? Try Jeff Moden's
splitter
.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Post #1407308
SQLRNNR
SQLRNNR
Posted Tuesday, January 15, 2013 8:54 AM
SSCoach
Group: General Forum Members
Last Login: Today @ 1:07 PM
Points: 18,733,
Visits: 12,332
Sean Lange (1/15/2013)
Great question Wayne. I knew the page would not be deallocated but I didn't know all of the details. The article was very interesting and informative read.
I wonder if Celko will start bashing Paul Randal for calling them records instead of rows??
Jason
AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server 2008
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1407312
« Prev Topic
|
Next Topic »
31 posts, Page 2 of 4
««
1
2
3
4
»
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.