diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-01-04 00:07:32 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-01-04 00:07:32 +0000 |
commit | 6cb1c0238b2503f485e3491902bfc294b7beeed1 (patch) | |
tree | 0cb4104e7027805adb1420ed182e4ff908fd0b0e /src/backend/optimizer/prep/prepunion.c | |
parent | 037e2fcf8fb4f5af00a5eceb26f4a2170e99b343 (diff) |
Rewrite OR indexscan processing to be more flexible. We can now for the
first time generate an OR indexscan for a two-column index when the WHERE
condition is like 'col1 = foo AND (col2 = bar OR col2 = baz)' --- before,
the OR had to be on the first column of the index or we'd not notice the
possibility of using it. Some progress towards extracting OR indexscans
from subclauses of an OR that references multiple relations, too, although
this code is #ifdef'd out because it needs more work.
Diffstat (limited to 'src/backend/optimizer/prep/prepunion.c')
-rw-r--r-- | src/backend/optimizer/prep/prepunion.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c index 1cecdb6c423..6866e95e4b3 100644 --- a/src/backend/optimizer/prep/prepunion.c +++ b/src/backend/optimizer/prep/prepunion.c @@ -14,7 +14,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.105 2003/11/29 19:51:51 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.106 2004/01/04 00:07:32 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -881,12 +881,9 @@ adjust_inherited_attrs_mutator(Node *node, newinfo->clause = (Expr *) adjust_inherited_attrs_mutator((Node *) oldinfo->clause, context); - /* - * We do NOT want to copy the original subclauseindices list, - * since the new rel will have different indices. The list will - * be rebuilt when needed during later planning. - */ - newinfo->subclauseindices = NIL; + /* and the modified version, if an OR clause */ + newinfo->orclause = (Expr *) + adjust_inherited_attrs_mutator((Node *) oldinfo->orclause, context); /* * Adjust left/right relid sets too. @@ -898,9 +895,13 @@ adjust_inherited_attrs_mutator(Node *node, context->old_rt_index, context->new_rt_index); - newinfo->eval_cost.startup = -1; /* reset these too */ + /* + * Reset cached derivative fields, since these might need to have + * different values when considering the child relation. + */ + newinfo->eval_cost.startup = -1; newinfo->this_selec = -1; - newinfo->left_pathkey = NIL; /* and these */ + newinfo->left_pathkey = NIL; newinfo->right_pathkey = NIL; newinfo->left_mergescansel = -1; newinfo->right_mergescansel = -1; |