mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
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.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.107 2001/06/17 02:05:19 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.108 2001/06/25 21:11:43 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -37,6 +37,7 @@
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/selfuncs.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user