diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-05-26 17:19:15 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-05-26 17:19:15 +0000 |
commit | b71761d2808a5b2d841bbccf193e326bdca0a52d (patch) | |
tree | 071f38de63a6bbf52597045f71472acc91e6e421 | |
parent | be6e7717db53812248d89c2ee798bb80e54a00ee (diff) | |
download | postgresql-b71761d2808a5b2d841bbccf193e326bdca0a52d.tar.gz postgresql-b71761d2808a5b2d841bbccf193e326bdca0a52d.zip |
Reduce eqsel()'s fudge-factor for estimating the frequency of values
other than the most common value in a column. We had had 0.5, make it
0.1 to make it more likely that an indexscan will be chosen. Really
need better statistics instead, but this should stem the bleeding
meanwhile ...
-rw-r--r-- | src/backend/utils/adt/selfuncs.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index a1405602ee4..4718dc668a7 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.65 2000/04/16 04:41:02 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.66 2000/05/26 17:19:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -55,6 +55,9 @@ /* default selectivity estimate for pattern-match operators such as LIKE */ #define DEFAULT_MATCH_SEL 0.01 +/* "fudge factor" for estimating frequency of not-most-common values */ +#define NOT_MOST_COMMON_RATIO 0.1 + static bool convert_to_scalar(Datum value, Oid valuetypid, double *scaledvalue, Datum lobound, Datum hibound, Oid boundstypid, double *scaledlobound, double *scaledhibound); @@ -190,7 +193,7 @@ eqsel(Oid opid, * exactly! */ if (typid != BOOLOID) - selec *= 0.5; + selec *= NOT_MOST_COMMON_RATIO; } } else @@ -209,7 +212,7 @@ eqsel(Oid opid, * and in fact it's probably less, so apply a fudge * factor. */ - selec *= 0.5; + selec *= NOT_MOST_COMMON_RATIO; } /* result should be in range, but make sure... */ |