Change hash indexes to store only the hash code rather than the whole indexed
commit6f1edfeb4c9303b3cb2ad7bef7cf9ab3ec8442dc
authortgl <tgl>
Mon, 15 Sep 2008 18:43:41 +0000 (15 18:43 +0000)
committertgl <tgl>
Mon, 15 Sep 2008 18:43:41 +0000 (15 18:43 +0000)
tree2f8e9f61df038dd94bf190d11565c921a639a530
parenta6eaf2989732ca778cc6aff44392084c702f6155
Change hash indexes to store only the hash code rather than the whole indexed
value.  This means that hash index lookups are always lossy and have to be
rechecked when the heap is visited; however, the gain in index compactness
outweighs this when the indexed values are wide.  Also, we only need to
perform datatype comparisons when the hash codes match exactly, rather than
for every entry in the hash bucket; so it could also win for datatypes that
have expensive comparison functions.  A small additional win is gained by
keeping hash index pages sorted by hash code and using binary search to reduce
the number of index tuples we have to look at.

Xiao Meng

This commit also incorporates Zdenek Kotala's patch to isolate hash metapages
and hash bitmaps a bit better from the page header datastructures.
13 files changed:
doc/src/sgml/catalogs.sgml
src/backend/access/hash/hash.c
src/backend/access/hash/hashinsert.c
src/backend/access/hash/hashovfl.c
src/backend/access/hash/hashpage.c
src/backend/access/hash/hashsearch.c
src/backend/access/hash/hashutil.c
src/backend/catalog/index.c
src/backend/utils/sort/tuplesort.c
src/include/access/hash.h
src/include/catalog/catversion.h
src/include/catalog/pg_am.h
src/include/catalog/pg_opclass.h