Update of /cvsroot/monetdb/sql/src/server
In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv16685/src/server
Modified Files:
bin_optimizer.mx
Log Message:
propagated changes of Saturday Jan 30 2010 - Sunday Jan 31 2010
from the Feb2010 branch to the development trunk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2010/01/30 - nielsnes: src/server/bin_optimizer.mx,1.25.2.1
the select statements didn't get pushed through the diffs and unions anymore.
Reason we added lots of 'st_alias'es around statements during the development
of the relational version. These st_aliases are now handled correctly fixing
the push down.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2010/01/30 - nielsnes: src/server/bin_optimizer.mx,1.25.2.2
kdiff for deletes is only needed once per table. So on (projection)joins
these aren't needed. This used to work but again because of st_alias
this broke.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: bin_optimizer.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/bin_optimizer.mx,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- bin_optimizer.mx 10 Jan 2010 15:33:34 -0000 1.25
+++ bin_optimizer.mx 31 Jan 2010 12:44:41 -0000 1.26
@@ -223,7 +223,7 @@
case st_join:
/* fetch join, look at the join operands */
- if (s->flag == cmp_equal &&
+ if (isEqJoin(s) &&
s->op1.stval->t && s->op1.stval->t == s->op2.stval->h)
return is_reduced(s->op1.stval) +
is_reduced(s->op2.stval);
@@ -280,7 +280,7 @@
/* push through the projection joins */
if (s->flag == 0 &&
- j->type == st_join && j->flag == cmp_equal &&
+ isEqJoin(j) &&
j->op1.stval->t && j->op1.stval->t == j->op2.stval->h) {
stmt *l = stmt_dup(j->op1.stval);
stmt *r = stmt_dup(j->op2.stval);
@@ -301,7 +301,7 @@
the topn into the right part */
if (s->flag != 0 /* topn, ie limit and orderby */ &&
j->type == st_join &&
- ((j->flag == cmp_equal &&
+ ((isEqJoin(j) &&
!is_reduced(j) &&
j->op1.stval->t && j->op1.stval->t == j->op2.stval->h) ||
j->flag == cmp_all)) {
@@ -381,8 +381,7 @@
if (os->op1.stval->type == st_join) {
j = os->op1.stval;
/* equi join on same base table */
- if (j->type == st_join &&
- j->flag == cmp_equal &&
+ if (isEqJoin(j) &&
j->op1.stval->t == j->op2.stval->h ) {
stmt *l = stmt_dup(j->op1.stval);
stmt *r = stmt_dup(j->op2.stval);
@@ -442,13 +441,22 @@
* if join on oids from the same table then
* right kdiff is not needed
*/
- if (s->type == st_join && s->flag == cmp_equal &&
+ if (isEqJoin(s) &&
s->op1.stval->t == s->op2.stval->h &&
s->op2.stval->type == st_diff){
stmt *old = s->op2.stval;
s->op2.stval = stmt_dup(old->op1.stval);
stmt_destroy(old);
}
+ /* same as above but now with alias in between */
+ if (isEqJoin(s) &&
+ s->op2.stval->type == st_alias &&
+ s->op1.stval->t == s->op2.stval->op1.stval->h &&
+ s->op2.stval->op1.stval->type == st_diff){
+ stmt *old = s->op2.stval;
+ s->op2.stval = stmt_dup(old->op1.stval->op1.stval);
+ stmt_destroy(old);
+ }
s->optimized = 3;
return stmt_dup(s);
}
@@ -477,6 +485,16 @@
case st_uselect2: {
stmt *res = NULL;
+ /* push down the select through st_alias */
+ if (s->op1.stval->type == st_alias) {
+ stmt *a = s->op1.stval;
+
+ s = push_select( s, stmt_dup(a->op1.stval));
+ s = stmt_alias(s, table_name(a), column_name(a));
+ res = bin_optimizer(c, s);
+ stmt_destroy(s);
+ return res;
+ }
/* push down the select through st_diff */
if (s->op1.stval->type == st_diff && s->flag != cmp_notequal) {
stmt *d = s->op1.stval;
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins