Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfa09f89

Browse files
committed
Clamp adjusted ndistinct to positive integer in estimate_hash_bucketsize().
This avoids a possible divide-by-zero in the following calculation,and rounding the number to an integer seems like saner behavior anyway.Assuming IEEE math, the division would yield +Infinity which would getreplaced by 1.0 at the bottom of the function, so nothing reallyinteresting would ensue; but avoiding divide-by-zero seems like agood idea on general principles.Per report from Piotr Stefaniak. No back-patch since this seemsmostly cosmetic.
1 parent408f043 commitfa09f89

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎src/backend/utils/adt/selfuncs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3541,7 +3541,10 @@ estimate_hash_bucketsize(PlannerInfo *root, Node *hashkey, double nbuckets)
35413541
* selectivity of rel's restriction clauses that mention the target Var.
35423542
*/
35433543
if (vardata.rel)
3544+
{
35443545
ndistinct *=vardata.rel->rows /vardata.rel->tuples;
3546+
ndistinct=clamp_row_est(ndistinct);
3547+
}
35453548

35463549
/*
35473550
* Initial estimate of bucketsize fraction is 1/nbuckets as long as the

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp