From 294c34bb9d8e253c3d8b0e0271e776fb0a992150 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 21 Nov 2004 22:57:00 +0000 Subject: [PATCH] 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. --- src/backend/utils/hash/dynahash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c index cf4e60e3c4..35398fb4c2 100644 --- a/src/backend/utils/hash/dynahash.c +++ b/src/backend/utils/hash/dynahash.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/hash/dynahash.c,v 1.56 2004/10/25 00:46:43 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/utils/hash/dynahash.c,v 1.57 2004/11/21 22:57:00 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -662,7 +662,7 @@ hash_search(HTAB *hashp, /* caller is expected to fill the data field on return */ /* Check if it is time to split the segment */ - if (++hctl->nentries / (long) (hctl->max_bucket + 1) > hctl->ffactor) + if (++hctl->nentries / (long) (hctl->max_bucket + 1) >= hctl->ffactor) { /* * NOTE: failure to expand table is not a fatal error, it