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

Commit68be513

Browse files
committed
If we don't have any stats for a boolean column, assume
the disbursion is 0.5, not something small.
1 parentdeee4e1 commit68be513

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

‎src/backend/utils/cache/lsyscache.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.39 2000/01/26 05:57:17 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.40 2000/02/16 01:00:23 tgl Exp $
1111
*
1212
* NOTES
1313
* Eventually, the index information should go through here, too.
@@ -183,6 +183,7 @@ double
183183
get_attdisbursion(Oidrelid,AttrNumberattnum,doublemin_estimate)
184184
{
185185
HeapTupleatp;
186+
Form_pg_attributeatt_tup;
186187
doubledisbursion;
187188
int32ntuples;
188189

@@ -197,10 +198,21 @@ get_attdisbursion(Oid relid, AttrNumber attnum, double min_estimate)
197198
relid,attnum);
198199
returnmin_estimate;
199200
}
201+
att_tup= (Form_pg_attribute)GETSTRUCT(atp);
200202

201-
disbursion=((Form_pg_attribute)GETSTRUCT(atp))->attdisbursion;
203+
disbursion=att_tup->attdisbursion;
202204
if (disbursion>0.0)
203-
returndisbursion;/* we have a specific estimate */
205+
returndisbursion;/* we have a specific estimate from VACUUM */
206+
207+
/*
208+
* Special-case boolean columns: the disbursion of a boolean is highly
209+
* unlikely to be anywhere near 1/numtuples, instead it's probably more
210+
* like 0.5.
211+
*
212+
* Are there any other cases we should wire in special estimates for?
213+
*/
214+
if (att_tup->atttypid==BOOLOID)
215+
return0.5;
204216

205217
/*
206218
* Disbursion is either 0 (no data available) or -1 (disbursion

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp