diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-01-27 20:51:54 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-01-27 20:51:54 +0000 |
commit | 70fba70430bd42b1a31c6d49646f9d1991eb8e7c (patch) | |
tree | 865c11bc1262e1fd48067f9b897abf2a50653ddf /src/backend/optimizer/path/joinpath.c | |
parent | b2773d4099d2dbccc4d23165a093581090c49451 (diff) | |
download | postgresql-70fba70430bd42b1a31c6d49646f9d1991eb8e7c.tar.gz postgresql-70fba70430bd42b1a31c6d49646f9d1991eb8e7c.zip |
Upgrade cost estimation for joins, per discussion with Bradley Baetz.
Try to model the effect of rescanning input tuples in mergejoins;
account for JOIN_IN short-circuiting where appropriate. Also, recognize
that mergejoin and hashjoin clauses may now be more than single operator
calls, so we have to charge appropriate execution costs.
Diffstat (limited to 'src/backend/optimizer/path/joinpath.c')
-rw-r--r-- | src/backend/optimizer/path/joinpath.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c index 0cbe7bbf83b..00b029f5f13 100644 --- a/src/backend/optimizer/path/joinpath.c +++ b/src/backend/optimizer/path/joinpath.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.76 2003/01/20 18:54:50 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.77 2003/01/27 20:51:51 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -774,13 +774,6 @@ hash_inner_and_outer(Query *root, * We examine each restrictinfo clause known for the join to see * if it is mergejoinable and involves vars from the two sub-relations * currently of interest. - * - * Since we currently allow only plain Vars as the left and right sides - * of mergejoin clauses, this test is relatively simple. This routine - * would need to be upgraded to support more-complex expressions - * as sides of mergejoins. In theory, we could allow arbitrarily complex - * expressions in mergejoins, so long as one side uses only vars from one - * sub-relation and the other side uses only vars from the other. */ static List * select_mergejoin_clauses(RelOptInfo *joinrel, @@ -835,7 +828,9 @@ select_mergejoin_clauses(RelOptInfo *joinrel, continue; /* not mergejoinable */ /* - * Check if clause is usable with these input rels. + * Check if clause is usable with these input rels. All the vars + * needed on each side of the clause must be available from one or + * the other of the input rels. */ if (is_subseti(restrictinfo->left_relids, outerrel->relids) && is_subseti(restrictinfo->right_relids, innerrel->relids)) |