aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/selfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-03-06 22:15:05 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-03-06 22:15:05 +0000
commit849074f9ae422c64501bb1d53ef840de870bf65c (patch)
tree9ac33ca6df68410da184659a4b0ca67f7bdf8bef /src/backend/utils/adt/selfuncs.c
parent31b6d840f6fdbf3d272e7bf8ec0461742edcdd46 (diff)
downloadpostgresql-849074f9ae422c64501bb1d53ef840de870bf65c.tar.gz
postgresql-849074f9ae422c64501bb1d53ef840de870bf65c.zip
Revise hash join code so that we can increase the number of batches
on-the-fly, and thereby avoid blowing out memory when the planner has underestimated the hash table size. Hash join will now obey the work_mem limit with some faithfulness. Per my recent proposal (hash aggregate part isn't done yet though).
Diffstat (limited to 'src/backend/utils/adt/selfuncs.c')
-rw-r--r--src/backend/utils/adt/selfuncs.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index b4536710eb0..c63eff09cdd 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.171 2005/02/01 23:07:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.172 2005/03/06 22:15:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2154,7 +2154,7 @@ estimate_num_groups(Query *root, List *groupExprs, double input_rows)
* inner rel is well-dispersed (or the alternatives seem much worse).
*/
Selectivity
-estimate_hash_bucketsize(Query *root, Node *hashkey, int nbuckets)
+estimate_hash_bucketsize(Query *root, Node *hashkey, double nbuckets)
{
VariableStatData vardata;
double estfract,
@@ -2212,8 +2212,8 @@ estimate_hash_bucketsize(Query *root, Node *hashkey, int nbuckets)
* the number of buckets is less than the expected number of distinct
* values; otherwise it is 1/ndistinct.
*/
- if (ndistinct > (double) nbuckets)
- estfract = 1.0 / (double) nbuckets;
+ if (ndistinct > nbuckets)
+ estfract = 1.0 / nbuckets;
else
estfract = 1.0 / ndistinct;