Consultor Eletrônico



Kbase 15385: -hash start up parameter - What does it do?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
-hash start up parameter - What does it do?


The -hash Startup Parameter

The database buffer pool is a collection of buffer headers that
contain descriptions of the buffer contents, and buffers that are used
to keep copies of recently used database blocks in memory. In order to
quickly determine whether a desired database block is present in the
buffer pool without time consuming searches, a "hash table" is used.
The hash table is a fixed size and contains pointers to buffer
headers.

To locate a specific buffer, the database block number is divided by
the size of the hash table and the remainder is used as the hash table
entry number. Note that this allows the possibility that several
blocks will be hashed to the same hash table entry. In such a case,
those buffer headers are connected together in a "hash chain" or
linked list.

Once the correct hash table entry has been determined, the entry is
examined. If it contains a zero, then the desired buffer is not
present in the buffer pool.

If the entry is nonzero, it is a pointer to a buffer header. The
buffer header is then examined to determine if it is for the desired
buffer. If it is, then the buffer has been located.

If the buffer header does not match the desired block, then the
header's "next buffer in the hash chain" pointer is examined to find
another buffer header with the same hash value, which is then
examined. The process is repeated until either the desired buffer is
found or it is determined that the desired buffer is not present. This
occurs when the "next" pointer is zero or a buffer header that refers
to a higher block number than the desired one is found.

The default value for -hash is a prime number approximately equal to
one fourth of the number of database buffers (specified with the -B
startup parameter). This provides for an average hash chain length of
4, approximately and a search will normally require examining at most
2 buffer headers, assuming that the distribution of blocks is even.

There is a small table of prime numbers (30 entries, the largest is
98407) with values increasing in a geometric progression using the
approximate ratio 1 to 1.4. The prime number table is identical in
versions 6.3, 7, and 8.

As mentioned above, the *average* hash chain length will be the number
of buffers (the value of -B) divided by the hash prime actually used.
The current upper limit for -B is 500,000 buffers.

With 500,000 buffers, the average chain length will be 500,000 / 98407
or 5.08 entries. To find a specific block thus requires examining 2.5
hash chain entries, on the average. Since the hash chains are ordered
by block number, searches may often be shorter than 2.5 entries.

This suggests that performance gains attributable to the -hash are
very small or even non-existent.

Progress Software Technical Support Note # 15385