diff options
| author | Bruce Momjian <bruce@momjian.us> | 2002-03-06 20:49:46 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2002-03-06 20:49:46 +0000 |
| commit | 7ab746731812fb4574f04a7402eaa40d15e29720 (patch) | |
| tree | 11883b3a5a44cf0401c3647599a3d1502c711623 /src/backend/access/hash/hashpage.c | |
| parent | 5b5cef9abd92e6e17f78cbf2838ac898f3427255 (diff) | |
| download | postgresql-7ab746731812fb4574f04a7402eaa40d15e29720.tar.gz | |
I've attached a patch which implements Bob Jenkin's hash function for
PostgreSQL. This hash function replaces the one used by hash indexes and
the catalog cache. Hash joins use a different, relatively poor-quality
hash function, but I'll fix that later.
As suggested by Tom Lane, this patch also changes the size of the fixed
hash table used by the catalog cache to be a power-of-2 (instead of a
prime: I chose 256 instead of 257). This allows the catcache to lookup
hash buckets using a simple bitmask. This should improve the performance
of the catalog cache slightly, since the previous method (modulo a
prime) was slow.
In my tests, this improves the performance of hash indexes by between 4%
and 8%; the performance when using btree indexes or seqscans is
basically unchanged.
Neil Conway <neilconway@rogers.com>
Diffstat (limited to 'src/backend/access/hash/hashpage.c')
| -rw-r--r-- | src/backend/access/hash/hashpage.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/access/hash/hashpage.c b/src/backend/access/hash/hashpage.c index 668f0b16d0..5d75b1e9b6 100644 --- a/src/backend/access/hash/hashpage.c +++ b/src/backend/access/hash/hashpage.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.34 2002/01/15 22:14:16 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.35 2002/03/06 20:49:42 momjian Exp $ * * NOTES * Postgres hash pages look like ordinary relation pages. The opaque @@ -151,7 +151,7 @@ _hash_metapinit(Relation rel) elog(ERROR, "Problem with _hash_initbitmap."); /* all done */ - _hash_wrtnorelbuf(rel, metabuf); + _hash_wrtnorelbuf(metabuf); /* * initialize the first two buckets @@ -260,7 +260,7 @@ _hash_wrtbuf(Relation rel, Buffer buf) * or a reference to the buffer. */ void -_hash_wrtnorelbuf(Relation rel, Buffer buf) +_hash_wrtnorelbuf(Buffer buf) { BlockNumber blkno; @@ -383,7 +383,7 @@ _hash_pagedel(Relation rel, ItemPointer tid) opaque = (HashPageOpaque) PageGetSpecialPointer(page); PageIndexTupleDelete(page, offno); - _hash_wrtnorelbuf(rel, buf); + _hash_wrtnorelbuf(buf); if (PageIsEmpty(page) && (opaque->hasho_flag & LH_OVERFLOW_PAGE)) { @@ -505,7 +505,7 @@ _hash_splitpage(Relation rel, nopaque->hasho_flag = LH_BUCKET_PAGE; nopaque->hasho_oaddr = InvalidOvflAddress; nopaque->hasho_bucket = nbucket; - _hash_wrtnorelbuf(rel, nbuf); + _hash_wrtnorelbuf(nbuf); /* * make sure the old bucket isn't empty. advance 'opage' and friends @@ -628,7 +628,7 @@ _hash_splitpage(Relation rel, == InvalidOffsetNumber) elog(ERROR, "_hash_splitpage: failed to add index item to %s", RelationGetRelationName(rel)); - _hash_wrtnorelbuf(rel, nbuf); + _hash_wrtnorelbuf(nbuf); /* * now delete the tuple from the old bucket. after this @@ -640,7 +640,7 @@ _hash_splitpage(Relation rel, * instead of calling PageGetMaxOffsetNumber. */ PageIndexTupleDelete(opage, ooffnum); - _hash_wrtnorelbuf(rel, obuf); + _hash_wrtnorelbuf(obuf); omaxoffnum = OffsetNumberPrev(omaxoffnum); /* |
