Berkeley DB: DbInfo::set_bt_prefix
Полезная информация


#include <db_cxx.h>

typedef size_t (*bt_prefix_fcn)(const DBT *, const DBT *); void DbInfo::set_bt_prefix(bt_prefix_fcn);


Set the Btree prefix comparison function. If specified, this method must return the number of bytes of the second key argument that are necessary to determine that it is greater than the first key argument. If the keys are equal, the key length should be returned.

The data and size fields of the Dbt are the only fields that may be used for the purposes of this comparison.

This function is used to compress the keys stored on the btree internal pages. The usefulness of this is data dependent, but in some data sets can produce significantly reduced tree sizes and search times.

If bt_prefix is not explicitly set, and no key comparison method is specified, a default lexical comparison method is used for prefix compression. If bt_prefix is not explicitly set and a key comparison method is specified, no prefix compression is done. It is an error to set bt_prefix without also specifying a key comparison method.



See Also

DbInfo::set_bt_compare, DbInfo::set_bt_maxkey, DbInfo::set_bt_minkey, DbInfo::set_bt_prefix, DbInfo::set_cachesize, DbInfo::set_compare, DbInfo::set_flags, DbInfo::set_h_ffactor, DbInfo::set_h_hash, DbInfo::set_h_nelem, DbInfo::set_lorder, DbInfo::set_malloc, DbInfo::set_pagesize, DbInfo::set_re_delim, DbInfo::set_re_len, DbInfo::set_re_pad and DbInfo::set_re_source.