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/hashovfl.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/hashovfl.c')
| -rw-r--r-- | src/backend/access/hash/hashovfl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/access/hash/hashovfl.c b/src/backend/access/hash/hashovfl.c index e41c1bd0a3..6a53eed9c9 100644 --- a/src/backend/access/hash/hashovfl.c +++ b/src/backend/access/hash/hashovfl.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.31 2001/10/25 05:49:21 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.32 2002/03/06 20:49:41 momjian Exp $ * * NOTES * Overflow pages look like ordinary relation pages. @@ -73,11 +73,11 @@ _hash_addovflpage(Relation rel, Buffer *metabufp, Buffer buf) ovflopaque->hasho_flag = LH_OVERFLOW_PAGE; ovflopaque->hasho_oaddr = oaddr; ovflopaque->hasho_bucket = pageopaque->hasho_bucket; - _hash_wrtnorelbuf(rel, ovflbuf); + _hash_wrtnorelbuf(ovflbuf); /* logically chain overflow page to previous page */ pageopaque->hasho_nextblkno = ovflblkno; - _hash_wrtnorelbuf(rel, buf); + _hash_wrtnorelbuf(buf); return ovflbuf; } @@ -574,7 +574,7 @@ _hash_squeezebucket(Relation rel, * the "next" ItemId. */ PageIndexTupleDelete(rpage, roffnum); - _hash_wrtnorelbuf(rel, rbuf); + _hash_wrtnorelbuf(rbuf); /* * if the "read" page is now empty because of the deletion, free |
