Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Buffer Pool Expand / Collapse
Author
Message
Posted Friday, November 9, 2012 12:05 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, July 25, 2014 3:20 AM
Points: 1,375, Visits: 2,661
GilaMonster (11/9/2012)
SQLSACT (11/9/2012)
[quote]I'm trying to understand what happens to clean pages in the buffer pool (when a select statement brings pages into the buffer pool).

What happens to the pages once the select statement is done with them?


Nothing.

Neither checkpoint nor lazywriter 'removes' dirty pages from the buffer pool. They just write the changes back to disk so that the pages are considered clean.


Ok

Now I'm really confused

The way I understood it is:
>> Insert, Update or Delete statement is received by SQL Server
>> Required pages are copied from disk into buffer pool
>> Changes are made to affected pages
>> Checkpoint/Lazy Writer process writes the pages back to disk, replacing the original page on disk.

Am I missing something here?

Thanks
Post #1383190
Posted Friday, November 9, 2012 4:28 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Sunday, July 20, 2014 7:16 AM
Points: 945, Visits: 1,769
SQLSACT (11/9/2012)
GilaMonster (11/9/2012)
SQLSACT (11/9/2012)
[quote]I'm trying to understand what happens to clean pages in the buffer pool (when a select statement brings pages into the buffer pool).

What happens to the pages once the select statement is done with them?


Nothing.

Neither checkpoint nor lazywriter 'removes' dirty pages from the buffer pool. They just write the changes back to disk so that the pages are considered clean.


Ok

Now I'm really confused

The way I understood it is:
>> Insert, Update or Delete statement is received by SQL Server
>> Required pages are copied from disk into buffer pool
>> Changes are made to affected pages
>> Checkpoint/Lazy Writer process writes the pages back to disk, replacing the original page on disk.

Am I missing something here?

Thanks


one last step, the now "clean" pages remain in the buffer pool as clean pages until SQL Server needs the memory for something else.



For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden for the best way to ask your question.

For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw

Need to Split some strings? Jeff Moden's DelimitedSplit8K
Jeff Moden's Cross tab and Pivots Part 1
Jeff Moden's Cross tab and Pivots Part 2

Jeremy Oursler
Post #1383292
Posted Friday, November 9, 2012 4:53 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 6:57 AM
Points: 7,084, Visits: 12,577
Joie Andrew (11/9/2012)
Take a look at Kalen Delaney's excellent book "Microsoft SQL Server 2008 Internals"

+1 An excellent source of this type of information.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1383302
Posted Saturday, November 10, 2012 12:34 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, July 25, 2014 3:20 AM
Points: 1,375, Visits: 2,661
capnhector (11/9/2012)
SQLSACT (11/9/2012)
GilaMonster (11/9/2012)
SQLSACT (11/9/2012)
[quote]I'm trying to understand what happens to clean pages in the buffer pool (when a select statement brings pages into the buffer pool).

What happens to the pages once the select statement is done with them?


Nothing.

Neither checkpoint nor lazywriter 'removes' dirty pages from the buffer pool. They just write the changes back to disk so that the pages are considered clean.


Ok

Now I'm really confused

The way I understood it is:
>> Insert, Update or Delete statement is received by SQL Server
>> Required pages are copied from disk into buffer pool
>> Changes are made to affected pages
>> Checkpoint/Lazy Writer process writes the pages back to disk, replacing the original page on disk.

Am I missing something here?

Thanks


one last step, the now "clean" pages remain in the buffer pool as clean pages until SQL Server needs the memory for something else.


Are these clean pages or clean buffers?

Thanks
Post #1383341
Posted Saturday, November 10, 2012 7:44 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, July 25, 2014 3:20 AM
Points: 1,375, Visits: 2,661
GilaMonster (11/9/2012)
SQLSACT (11/9/2012)
[quote]I'm trying to understand what happens to clean pages in the buffer pool (when a select statement brings pages into the buffer pool).

What happens to the pages once the select statement is done with them?


Nothing.

Neither checkpoint nor lazywriter 'removes' dirty pages from the buffer pool. They just write the changes back to disk so that the pages are considered clean.


Thanks Gail

Please help me understand this process

When a checkpoint runs, it doesn't actually remove the page from memory, it marks the page as clean? Does this mean that it removes the contents of the page?

Thanks
Post #1383368
Posted Saturday, November 10, 2012 7:55 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Sunday, July 20, 2014 7:16 AM
Points: 945, Visits: 1,769
SQLSACT (11/10/2012)


Are these clean pages or clean buffers?

Thanks


these are clean pages. SQL Server only drops pages from the buffer if there is not enough memory (or the server is restarted or you manually drop the cache). otherwise SQL Server holds the pages in memory for the next time they are accessed. that way the next query that is run the server wont have to read those pages from disk again. if the database is smaller than the ram on the system eventually the entire database may sit in memory and there is very little reading from disk. if the database is larger than the amount of ram on the system SQL Server has a very well designed algorithm for figuring out which pages have not been accessed in a while.



For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden for the best way to ask your question.

For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw

Need to Split some strings? Jeff Moden's DelimitedSplit8K
Jeff Moden's Cross tab and Pivots Part 1
Jeff Moden's Cross tab and Pivots Part 2

Jeremy Oursler
Post #1383369
Posted Saturday, November 10, 2012 7:56 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 9:05 AM
Points: 42,469, Visits: 35,540
SQLSACT (11/10/2012)
Does this mean that it removes the contents of the page?


No. I already told you more than once what happens when checkpoint writes a page. I'm pretty sure I've also told you the definition of 'clean page' more than once, to start with...
They just write the changes back to disk so that the pages are considered clean.


That doesn't say 'clear', 'empty', or 'discard' anywhere.

Please go and read some of the material that I and others have referred you to, Kalen's book especially



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1383370
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse