diff options
| author | Tom Lane | 2003-12-30 23:53:15 +0000 |
|---|---|---|
| committer | Tom Lane | 2003-12-30 23:53:15 +0000 |
| commit | be6c38b9033c546e2a8a9fab4329b89be57a263b (patch) | |
| tree | 521c34b2c94d52614160a5582654751e089b226e /src/include | |
| parent | 5e545151671fa4ab3cf0e62ffd1e207609ad1517 (diff) | |
Adjust the definition of RestrictInfo's left_relids and right_relids
fields: now they are valid whenever the clause is a binary opclause,
not only when it is a potential join clause (there is a new boolean
field canjoin to signal the latter condition). This lets us avoid
recomputing the relid sets over and over while examining indexes.
Still more work to do to make this as useful as it could be, because
there are places that could use the info but don't have access to the
RestrictInfo node.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/nodes/relation.h | 24 | ||||
| -rw-r--r-- | src/include/optimizer/clauses.h | 3 |
2 files changed, 16 insertions, 11 deletions
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index 6b205b20da..0d129f38ea 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.87 2003/12/28 21:57:37 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.88 2003/12/30 23:53:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -596,6 +596,19 @@ typedef struct RestrictInfo bool ispusheddown; /* TRUE if clause was pushed down in level */ + /* + * This flag is set true if the clause looks potentially useful as a + * merge or hash join clause, that is if it is a binary opclause with + * nonoverlapping sets of relids referenced in the left and right sides. + * (Whether the operator is actually merge or hash joinable isn't + * checked, however.) + */ + bool canjoin; + + /* These fields are set for any binary opclause: */ + Relids left_relids; /* relids in left side of clause */ + Relids right_relids; /* relids in right side of clause */ + /* only used if clause is an OR clause: */ List *subclauseindices; /* indexes matching subclauses */ /* subclauseindices is a List of Lists of IndexOptInfos */ @@ -604,15 +617,6 @@ typedef struct RestrictInfo QualCost eval_cost; /* eval cost of clause; -1 if not yet set */ Selectivity this_selec; /* selectivity; -1 if not yet set */ - /* - * If the clause looks useful for joining --- that is, it is a binary - * opclause with nonoverlapping sets of relids referenced in the left - * and right sides --- then these two fields are set to sets of the - * referenced relids. Otherwise they are both NULL. - */ - Relids left_relids; /* relids in left side of join clause */ - Relids right_relids; /* relids in right side of join clause */ - /* valid if clause is mergejoinable, else InvalidOid: */ Oid mergejoinoperator; /* copy of clause operator */ Oid left_sortop; /* leftside sortop needed for mergejoin */ diff --git a/src/include/optimizer/clauses.h b/src/include/optimizer/clauses.h index 7fb60b548e..3e089256a5 100644 --- a/src/include/optimizer/clauses.h +++ b/src/include/optimizer/clauses.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/clauses.h,v 1.69 2003/11/29 22:41:07 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/clauses.h,v 1.70 2003/12/30 23:53:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -54,6 +54,7 @@ extern bool contain_volatile_functions(Node *clause); extern bool contain_nonstrict_functions(Node *clause); extern bool is_pseudo_constant_clause(Node *clause); +extern bool is_pseudo_constant_clause_relids(Node *clause, Relids relids); extern List *pull_constant_clauses(List *quals, List **constantQual); extern bool has_distinct_on_clause(Query *query); |
