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

Commitf772e6c

Browse files
committed
Clamp the output of estimate_hash_bucketsize() to a sane range;
per example from Bruno Wolff in which it produced a silly result.
1 parent1dfbbd5 commitf772e6c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

‎src/backend/optimizer/path/costsize.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* Portions Copyright (c) 1994, Regents of the University of California
4343
*
4444
* IDENTIFICATION
45-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.96 2002/12/14 00:17:55 tgl Exp $
45+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.97 2002/12/26 23:38:42 tgl Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -1164,6 +1164,16 @@ estimate_hash_bucketsize(Query *root, Var *var)
11641164
if (avgfreq>0.0&&mcvfreq>avgfreq)
11651165
estfract *=mcvfreq /avgfreq;
11661166

1167+
/*
1168+
* Clamp bucketsize to sane range (the above adjustment could easily
1169+
* produce an out-of-range result). We set the lower bound a little
1170+
* above zero, since zero isn't a very sane result.
1171+
*/
1172+
if (estfract<1.0e-6)
1173+
estfract=1.0e-6;
1174+
elseif (estfract>1.0)
1175+
estfract=1.0;
1176+
11671177
ReleaseSysCache(tuple);
11681178

11691179
return (Selectivity)estfract;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp