diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-09-20 19:50:21 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-09-20 19:50:21 +0000 |
commit | bfd1ffa948e676f0587239a36e71f15690ef2cde (patch) | |
tree | 0f29dd2001a93fa708142d94f62f940967b09f6b /src/include | |
parent | 06b33f0ee8481a83f9e62c0fc77ab16afb4aeec1 (diff) |
Change patternsel (LIKE/regex selectivity estimation) so that if there
is a large enough histogram, it will use the number of matches in the
histogram to derive a selectivity estimate, rather than the admittedly
pretty bogus heuristics involving examining the pattern contents. I set
'large enough' at 100, but perhaps we should change that later. Also
apply the same technique in contrib/ltree's <@ and @> estimator. Per
discussion with Stefan Kaltenbrunner and Matteo Beccati.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/utils/selfuncs.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/include/utils/selfuncs.h b/src/include/utils/selfuncs.h index 065e9a5e221..aea2501ca39 100644 --- a/src/include/utils/selfuncs.h +++ b/src/include/utils/selfuncs.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/selfuncs.h,v 1.34 2006/07/01 22:07:23 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/selfuncs.h,v 1.35 2006/09/20 19:50:21 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -110,6 +110,9 @@ extern double get_variable_numdistinct(VariableStatData *vardata); extern double mcv_selectivity(VariableStatData *vardata, FmgrInfo *opproc, Datum constval, bool varonleft, double *sumcommonp); +extern double histogram_selectivity(VariableStatData *vardata, FmgrInfo *opproc, + Datum constval, bool varonleft, + int min_hist_size, int n_skip); extern Pattern_Prefix_Status pattern_fixed_prefix(Const *patt, Pattern_Type ptype, |