<!--$Id: h_hash.so,v 10.12 2000/07/04 18:28:27 bostic Exp $-->
<!--Copyright (c) 1997,2008 Oracle. All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB Reference Guide: Specifying a database hash</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<a name="2"><!--meow--></a>
<table width="100%"><tr valign=top>
<td><b><dl><dt>Berkeley DB Reference Guide:<dd>Access Methods</dl></b></td>
<td align=right><a href="../am_conf/h_ffactor.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../am_conf/h_nelem.html"><img src="../../images/next.gif" alt="Next"></a>
</td></tr></table>
<p align=center><b>Specifying a database hash</b></p>
<p>The database hash determines in which bucket a particular key will reside.
The goal of hashing keys is to distribute keys equally across the database
pages, therefore it is important that the hash function work well with
the specified keys so that the resulting bucket usage is relatively
uniform. A hash function that does not work well can effectively turn
into a sequential list.</p>
<p>No hash performs equally well on all possible data sets. It is possible
that applications may find that the default hash function performs poorly
with a particular set of keys. The distribution resulting from the hash
function can be checked using <a href="../../utility/db_stat.html">db_stat</a> utility. By comparing the
number of hash buckets and the number of keys, one can decide if the entries
are hashing in a well-distributed manner.</p>
<p>The hash function for the hash table can be specified by calling the
<a href="../../api_c/db_set_h_hash.html">DB->set_h_hash</a> method. If no hash function is specified, a default
function will be used. Any application-specified hash function must
take a reference to a <a href="../../api_c/db_class.html">DB</a> object, a pointer to a byte string and
its length, as arguments and return an unsigned, 32-bit hash value.</p>
<table width="100%"><tr><td><br></td><td align=right><a href="../am_conf/h_ffactor.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../am_conf/h_nelem.html"><img src="../../images/next.gif" alt="Next"></a>
</td></tr></table>
<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font>
</body>
</html>
Copyright 2K16 - 2K18 Indonesian Hacker Rulez