Skip to content

Commit 294c34b

Browse files
committed
Fix rounding problem in dynahash.c's decision about when the target
fill factor has been exceeded. We usually run with ffactor == 1, but the way the test was coded, it wouldn't split a bucket until the actual fill factor reached 2.0, because of use of integer division. Change from > to >= so that it will split more aggressively when the table starts to get full.
1 parent 7f1711f commit 294c34b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/utils/hash/dynahash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/utils/hash/dynahash.c,v 1.56 2004/10/25 00:46:43 neilc Exp $
12+
* $PostgreSQL: pgsql/src/backend/utils/hash/dynahash.c,v 1.57 2004/11/21 22:57:00 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -662,7 +662,7 @@ hash_search(HTAB *hashp,
662662
/* caller is expected to fill the data field on return */
663663

664664
/* Check if it is time to split the segment */
665-
if (++hctl->nentries / (long) (hctl->max_bucket + 1) > hctl->ffactor)
665+
if (++hctl->nentries / (long) (hctl->max_bucket + 1) >= hctl->ffactor)
666666
{
667667
/*
668668
* NOTE: failure to expand table is not a fatal error, it

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy