You were brought to this page based on an internet search
and as a free service to Oracle DBAs.
The text below is an except from the book,
Oracle Performance Firefighting, written by
Craig Shallahamer of
OraPub, Inc.
Figures and tables are not included on this page, only their reference.
To order the book in either print or PDF form, click
here.
©2009, 2010 by Craig Shallahamer. This is copyrighted material.
PleaseOut of respect for those involved in the creation of the book and also for
their familes, we ask you to respect the copyright both in intent and deed. Thank you.
-------------------------------
This is actually quite easy to simulate. Simply create a table with a column that will contain a sequence number. Create an index on the sequence number column, and then create the sequence with an increasing value of one. Now have multiple sessions (perhaps only ten) begin concurrently inserting rows into the table. Make sure each of these sessions uses the next sequence number in its insert statement. Since the sequence numbers will be sequential, the indexed column contains the sequence number, and the index entries must be stored in sorted order, it is very likely that nearly all of the concurrent sessions will be making entries into the same index leaf block! With this load occurring, run any wait event report, or simply look at the v$session or v$session_wait views, and observe the sessions posting buffer busy waits events. If you determine the object based on the file number and block number (p1 and p2), it will be the index! Exciting yes, but very bad for performance.
One solution is to have Oracle store the indexed sequence numbers (1, 2, 3, and so on) with their bytes reversed. From a DBA perspective, the sequence numbers are just as they were before, but internally their bytes will be reversed. Because index entries must be stored in sorted order internally, the index entries will probably be placed into different index leaf blocks, eliminating the buffer busy waits events.
Here's an example of how Oracle reverses the bytes of each indexed column. Suppose the sequence numbers are represented in 4 bytes. So the first four sequences (1, 2, 3, 4) would be represented as 0001, 0010, 0011, and 0100. If these four values were used in the index, because index ordering must be maintained, they will be placed next to each other. However, if they bytes were reversed, they would be represented like this: 1000, 0100, 1100, and 0010. Since they must also be placed into the index in sorted order, they will likely not be placed into the same index leaf block. In fact, they will probably span all the index leaf blocks. As a result of key reversal, the buffer busy wait will be eliminated.
©2009, 2010 by Craig Shallahamer. This is copyrighted material.
PleaseOut of respect for those involved in the creation of the book and also for
their familes, we ask you to respect the copyright both in intent and deed. Thank you.
|