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.
-------------------------------
Given 1,000 random numbers between 0 and 1,000, the modulus hash function does in fact produce the histogram shown in Figure 6-7. But suppose the situation is not quite so random. Suppose the first 500 numbers are from 0 to 5 and the remaining 500 are between 0 and 1,000. Using the same modulus 10 hash function, the result is the histogram shown in Figure 6-8. This is unfortunate, because clearly the hash function does not return evenly dispersed numbers.
This is indeed the situation with Oracle! Oracle blocks are not randomly accessed because SQL is not randomly run from random users doing random tasks (at least, we hope not). So unless Oracle uses a more advanced hashing algorithm, the hashed results can easily look like those in Figure 6-8. This forces Oracle to develop a specific hashing function to transform a Figure 6-8 situation into a Figure 6-7 situation. As you might expect, Oracle's buffer hashing algorithm is proprietary information, but I would be willing to wager that prime numbers are involved somehow.
Figure 6-8. Given nonrandom numbers, a simple modulus hash function is not likely to produce an even distribution, but more like what this figure shows. This graph is based on 1,000 inputs, the first 500 between 0 and 5, and the remaining 500 between 0 and 1,000.
©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.
|