]> granicus.if.org Git - postgresql/commit
Change hash indexes to store only the hash code rather than the whole indexed
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 15 Sep 2008 18:43:41 +0000 (18:43 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 15 Sep 2008 18:43:41 +0000 (18:43 +0000)
commit4adc2f72a4ccd6e55e594aca837f09130a6af62b
tree6da4349e66c02ce2d76fe9600ff7ac8aeee741cb
parent440b3384b0741199b4f56a8aac773ecd16aba137
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