RE: Cache hash chains
Date: Wed, 4 Mar 2015 16:32:24 +0100 (CET)
Message-ID: <811596412.174932.1425483144874.JavaMail.open-xchange_at_app10.ox.hosteurope.de>
Hi Paul,
it is all about doing less work. It works differently in case of the need of a read consistent data block. Jonathan Lewis also described this in his book "Oracle Core: Essential Internals for DBAs and Developers" on page 116 & 117 - quoting from it again.
"We find that the CUR (current) version of the block is in memory, but the SCN is higher than the start SCN for our query, so we may need to create a
read-consistent copy of the block. Before we start on the work of creating a copy, though, we can carry on walking down the hash chain because it’s
possible that an appropriate read-consistent copy already exists. There is a tiny optimization built into the hash chain at this point—the CUR version
of a block is always the first one you will find as you walk the hash chain. I also recall seeing a note many years ago suggesting that any CR copies
will appear in SCN order on the chain, most recent SCN first, but the first test I ran didn’t seem to agree with the hypothesis. If we don’t find a
copy that matches our needs exactly, we will either clone the CUR copy or be lucky and find that we can use one of the CR copies as a starting point,
which will save us a little effort because it will be nearer to our target point in time.
…
Once we’ve made it that far we can release any latches we are still holding and start taking the block backward in time. This, of course, means we
will have to start locating and applying undo records, which means getting cache buffers chains latches and searching hash buckets for undo
blocks—possibly even reading older undo blocks from disc into memory."
I think it would be a good idea to buy this book and to invest a few bucks, if you are interested into such internals. This book is absolutely worth the money.
Best Regards
Stefan Koehler
Freelance Oracle performance consultant and researcher
Homepage: http://www.soocs.de
Twitter: _at_OracleSK
> Paul Harrison <cure_at_austin.rr.com> hat am 4. März 2015 um 15:21 geschrieben:
>
>
> Hi Jonathan,
>
> Thanks for the clarification.
>
> This might be a dumb question but why would Oracle create copies of the current data block when the current data block has an associated undo block
> for read consistent queries?
>
> For example, Oracle walks down the cache buffer chain to find the current data buffer header for the current data block. If Oracle realize the data
> block is currently in a transaction then walks down the cache buffer chain again to find the data buffer header associated with the undo segment.
> Since Oracle already created an undo block for the transaction then why clone the current data blocks?
>
> Thank You,
> Paul
-- http://www.freelists.org/webpage/oracle-lReceived on Wed Mar 04 2015 - 16:32:24 CET