Changeset: ebe40b26ed09 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ebe40b26ed09
Modified Files:
sql/server/rel_optimizer.c
Branch: default
Log Message:
Also test for unique expression on the right side of the comparison, and run
rel_push_select_up only when full optimization is needed
diffs (30 lines):
diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -4794,9 +4794,14 @@ point_select_on_unique_column(sql_rel *r
if (is_compare(e->type) && e->flag == cmp_equal) {
if (is_numeric_upcast(el))
el = el->l;
+ if (is_numeric_upcast(er))
+ er = er->l;
if (is_alias(el->type) && exp_is_atom(er) &&
(found = rel_find_exp(rel->l, el)) &&
is_unique(found) && (!is_semantics(e)
|| !has_nil(found) || !has_nil(er)))
return true;
+ if (is_alias(er->type) && exp_is_atom(el) &&
(found = rel_find_exp(rel->l, er)) &&
+ is_unique(found) && (!is_semantics(e)
|| !has_nil(el) || !has_nil(found)))
+ return true;
}
}
}
@@ -9849,8 +9854,9 @@ rel_optimizer(mvc *sql, sql_rel *rel, in
#ifndef NDEBUG
assert(level < 20);
#endif
- /* Run the following optimizers only once after the others run to avoid
an infinite optimization loop */
- rel = rel_visitor_bottomup(&v, rel, &rel_push_select_up);
+ /* Run the following optimizers only once at the end to avoid an
infinite optimization loop */
+ if (opt == 2)
+ rel = rel_visitor_bottomup(&v, rel, &rel_push_select_up);
/* merge table rewrites may introduce remote or replica tables */
if (instantiate && (gp.needs_mergetable_rewrite ||
gp.needs_remote_replica_rewrite)) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list