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.
-------------------------------
The library cache object hashing situation is more complicated than with block hashing. We're not dealing with a file number and a block number. This situation requires hashing the object's text. So if a SQL statement or a package is 2,000 lines long, Oracle may choose to hash all this text.
Generating a hash value for text is far more interesting than generating one for a number. One way to hash text is to associate each character with a number and then sum all the numbers. For example, if a is to 1, b is to 2, and c is to 3, then the hash value of string abbc is 8 (1 + 2 + 2 + 3). Figure 7-8 is a simple hash value generator and hash function Perl script.
Figure 7-8. Shown is an example of a text hashing and bucket assignment function written in Perl. The hash function is the modulus (%) operator.
©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.
|