diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-06-25 21:11:45 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-06-25 21:11:45 +0000 |
| commit | 4d58a7ca878bbb0a252e1d8175a7ea3a385c1d9e (patch) | |
| tree | e4e6dae9e84149ea8ffe2e6d7c35cf101b6b10ab /src/backend/optimizer/path/clausesel.c | |
| parent | c31545af2720591b21ad0039b3160225acd328b9 (diff) | |
| download | postgresql-4d58a7ca878bbb0a252e1d8175a7ea3a385c1d9e.tar.gz | |
Optimizer can now estimate selectivity of IS NULL, IS NOT NULL,
IS TRUE, etc, with some degree of verisimilitude. Split out
selectivity support functions from builtins.h into a new header
file selfuncs.h, so as to reduce the number of header files builtins.h
must depend on. Fix a few missing inclusions exposed thereby.
From Joe Conway, with some kibitzing from Tom Lane.
Diffstat (limited to 'src/backend/optimizer/path/clausesel.c')
| -rw-r--r-- | src/backend/optimizer/path/clausesel.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/backend/optimizer/path/clausesel.c b/src/backend/optimizer/path/clausesel.c index cafc01fc33..36d8f229f1 100644 --- a/src/backend/optimizer/path/clausesel.c +++ b/src/backend/optimizer/path/clausesel.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.45 2001/06/05 05:26:04 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.46 2001/06/25 21:11:43 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -24,6 +24,7 @@ #include "parser/parsetree.h" #include "utils/fmgroids.h" #include "utils/lsyscache.h" +#include "utils/selfuncs.h" /* note that pg_type.h hardwires size of bool as 1 ... duplicate it */ @@ -509,6 +510,16 @@ clause_selectivity(Query *root, */ s1 = (Selectivity) 0.5; } + else if (IsA(clause, NullTest)) + { + /* Use node specific selectivity calculation function */ + s1 = nulltestsel(root, (NullTest *) clause, varRelid); + } + else if (IsA(clause, BooleanTest)) + { + /* Use node specific selectivity calculation function */ + s1 = booltestsel(root, (BooleanTest *) clause, varRelid); + } else if (IsA(clause, RelabelType)) { /* Not sure this case is needed, but it can't hurt */ @@ -517,5 +528,9 @@ clause_selectivity(Query *root, varRelid); } +#ifdef SELECTIVITY_DEBUG + elog(NOTICE, "clause_selectivity: s1 %f", s1); +#endif /* SELECTIVITY_DEBUG */ + return s1; } |
