1999-02-03 21:15:53 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* restrictinfo.h
|
1999-02-03 21:15:53 +01:00
|
|
|
* prototypes for restrictinfo.c.
|
|
|
|
*
|
|
|
|
*
|
2006-03-05 16:59:11 +01:00
|
|
|
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1999-02-03 21:15:53 +01:00
|
|
|
*
|
2006-10-04 02:30:14 +02:00
|
|
|
* $PostgreSQL: pgsql/src/include/optimizer/restrictinfo.h,v 1.38 2006/10/04 00:30:09 momjian Exp $
|
1999-02-03 21:15:53 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef RESTRICTINFO_H
|
|
|
|
#define RESTRICTINFO_H
|
|
|
|
|
|
|
|
#include "nodes/relation.h"
|
|
|
|
|
2005-06-06 00:32:58 +02:00
|
|
|
|
2005-06-09 06:19:00 +02:00
|
|
|
extern RestrictInfo *make_restrictinfo(Expr *clause,
|
2005-10-15 04:49:52 +02:00
|
|
|
bool is_pushed_down,
|
2005-11-15 00:54:23 +01:00
|
|
|
bool outerjoin_delayed,
|
Revise the planner's handling of "pseudoconstant" WHERE clauses, that is
clauses containing no variables and no volatile functions. Such a clause
can be used as a one-time qual in a gating Result plan node, to suppress
plan execution entirely when it is false. Even when the clause is true,
putting it in a gating node wins by avoiding repeated evaluation of the
clause. In previous PG releases, query_planner() would do this for
pseudoconstant clauses appearing at the top level of the jointree, but
there was no ability to generate a gating Result deeper in the plan tree.
To fix it, get rid of the special case in query_planner(), and instead
process pseudoconstant clauses through the normal RestrictInfo qual
distribution mechanism. When a pseudoconstant clause is found attached to
a path node in create_plan(), pull it out and generate a gating Result at
that point. This requires special-casing pseudoconstants in selectivity
estimation and cost_qual_eval, but on the whole it's pretty clean.
It probably even makes the planner a bit faster than before for the normal
case of no pseudoconstants, since removing pull_constant_clauses saves one
useless traversal of the qual tree. Per gripe from Phil Frost.
2006-07-01 20:38:33 +02:00
|
|
|
bool pseudoconstant,
|
2005-10-15 04:49:52 +02:00
|
|
|
Relids required_relids);
|
2005-04-25 04:14:48 +02:00
|
|
|
extern List *make_restrictinfo_from_bitmapqual(Path *bitmapqual,
|
2005-10-15 04:49:52 +02:00
|
|
|
bool is_pushed_down,
|
|
|
|
bool include_predicates);
|
1999-07-25 01:21:14 +02:00
|
|
|
extern bool restriction_is_or_clause(RestrictInfo *restrictinfo);
|
1999-02-03 21:15:53 +01:00
|
|
|
extern List *get_actual_clauses(List *restrictinfo_list);
|
Revise the planner's handling of "pseudoconstant" WHERE clauses, that is
clauses containing no variables and no volatile functions. Such a clause
can be used as a one-time qual in a gating Result plan node, to suppress
plan execution entirely when it is false. Even when the clause is true,
putting it in a gating node wins by avoiding repeated evaluation of the
clause. In previous PG releases, query_planner() would do this for
pseudoconstant clauses appearing at the top level of the jointree, but
there was no ability to generate a gating Result deeper in the plan tree.
To fix it, get rid of the special case in query_planner(), and instead
process pseudoconstant clauses through the normal RestrictInfo qual
distribution mechanism. When a pseudoconstant clause is found attached to
a path node in create_plan(), pull it out and generate a gating Result at
that point. This requires special-casing pseudoconstants in selectivity
estimation and cost_qual_eval, but on the whole it's pretty clean.
It probably even makes the planner a bit faster than before for the normal
case of no pseudoconstants, since removing pull_constant_clauses saves one
useless traversal of the qual tree. Per gripe from Phil Frost.
2006-07-01 20:38:33 +02:00
|
|
|
extern List *extract_actual_clauses(List *restrictinfo_list,
|
2006-10-04 02:30:14 +02:00
|
|
|
bool pseudoconstant);
|
Revise the planner's handling of "pseudoconstant" WHERE clauses, that is
clauses containing no variables and no volatile functions. Such a clause
can be used as a one-time qual in a gating Result plan node, to suppress
plan execution entirely when it is false. Even when the clause is true,
putting it in a gating node wins by avoiding repeated evaluation of the
clause. In previous PG releases, query_planner() would do this for
pseudoconstant clauses appearing at the top level of the jointree, but
there was no ability to generate a gating Result deeper in the plan tree.
To fix it, get rid of the special case in query_planner(), and instead
process pseudoconstant clauses through the normal RestrictInfo qual
distribution mechanism. When a pseudoconstant clause is found attached to
a path node in create_plan(), pull it out and generate a gating Result at
that point. This requires special-casing pseudoconstants in selectivity
estimation and cost_qual_eval, but on the whole it's pretty clean.
It probably even makes the planner a bit faster than before for the normal
case of no pseudoconstants, since removing pull_constant_clauses saves one
useless traversal of the qual tree. Per gripe from Phil Frost.
2006-07-01 20:38:33 +02:00
|
|
|
extern void extract_actual_join_clauses(List *restrictinfo_list,
|
|
|
|
List **joinquals,
|
|
|
|
List **otherquals);
|
2005-06-06 00:32:58 +02:00
|
|
|
extern List *remove_redundant_join_clauses(PlannerInfo *root,
|
2003-08-04 02:43:34 +02:00
|
|
|
List *restrictinfo_list,
|
2005-04-22 23:58:32 +02:00
|
|
|
bool isouterjoin);
|
2005-06-06 00:32:58 +02:00
|
|
|
extern List *select_nonredundant_join_clauses(PlannerInfo *root,
|
2003-08-04 02:43:34 +02:00
|
|
|
List *restrictinfo_list,
|
|
|
|
List *reference_list,
|
2005-04-22 23:58:32 +02:00
|
|
|
bool isouterjoin);
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* RESTRICTINFO_H */
|