Update of /cvsroot/monetdb/pathfinder/compiler/algebra
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv29148/algebra

Modified Files:
        physical.c 
Log Message:
Try to generate better plans for attribute steps.


U physical.c
Index: physical.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/physical.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- physical.c  10 Mar 2009 12:20:39 -0000      1.88
+++ physical.c  13 Mar 2009 20:54:50 -0000      1.89
@@ -2709,31 +2709,62 @@
 
     /* ---- LLSCJoin: costs ---- */
 
-    if (PFord_implies (ret->sem.scjoin.in, iter_item)) {
-        /* input has iter|item ordering */
+    if (spec.axis == alg_attr) {
+        if (PFord_implies (ret->sem.scjoin.in, iter_item)) {
+            /* input has iter|item ordering */
+
+            if (PFord_implies (ret->sem.scjoin.out, iter_item)) {
+                /* output has iter|item ordering */
+                ret->cost = 0 * SORT_COST;
+            }
+            else {
+                /* output has item|iter ordering */
+                ret->cost = 2 * SORT_COST;
+            }
 
-        if (PFord_implies (ret->sem.scjoin.out, iter_item)) {
-            /* output has iter|item ordering */
-            ret->cost = 3 * SORT_COST;
         }
         else {
-            /* output has item|iter ordering */
-            ret->cost = 2 * SORT_COST;
-        }
+            /* input has item|iter ordering */
+
+            if (PFord_implies (ret->sem.scjoin.out, iter_item)) {
+                /* output has iter|item ordering */
+                ret->cost = 1 * SORT_COST;
+            }
+            else {
+                /* output has item|iter ordering */
 
+                /* should be cheapest */
+                ret->cost = 3 * SORT_COST;
+            }
+        }
     }
     else {
-        /* input has item|iter ordering */
+        if (PFord_implies (ret->sem.scjoin.in, iter_item)) {
+            /* input has iter|item ordering */
+
+            if (PFord_implies (ret->sem.scjoin.out, iter_item)) {
+                /* output has iter|item ordering */
+                ret->cost = 3 * SORT_COST;
+            }
+            else {
+                /* output has item|iter ordering */
+                ret->cost = 2 * SORT_COST;
+            }
 
-        if (PFord_implies (ret->sem.scjoin.out, iter_item)) {
-            /* output has iter|item ordering */
-            ret->cost = 1 * SORT_COST;
         }
         else {
-            /* output has item|iter ordering */
+            /* input has item|iter ordering */
 
-            /* should be cheapest */
-            ret->cost = 0 * SORT_COST;
+            if (PFord_implies (ret->sem.scjoin.out, iter_item)) {
+                /* output has iter|item ordering */
+                ret->cost = 1 * SORT_COST;
+            }
+            else {
+                /* output has item|iter ordering */
+
+                /* should be cheapest */
+                ret->cost = 0 * SORT_COST;
+            }
         }
     }
 
@@ -2860,6 +2891,16 @@
                 ret->cost = 3 * SORT_COST;
             }
         }
+
+        if (PFprop_key (ctx->prop, item)) 
+            /* staircase-join with duplicates should
+               be more less expensive if the output does
+               not contain duplicates and can be reused */
+            ret->cost += ctx->cost;
+        else
+            /* staircase-join with duplicates should
+               be more expensive than normal staircase-join */
+            ret->cost += ctx->cost + 5 * JOIN_COST;
     }
     else {
         if (!ret->sem.scjoin.in) {
@@ -2889,12 +2930,11 @@
                 ret->cost = 0 * SORT_COST;
             }
         }
+        /* staircase-join with duplicates should
+           be more expensive than normal staircase-join */
+        ret->cost += ctx->cost + 5 * JOIN_COST;
     }
 
-    /* staircase-join with duplicates should
-       be more expensive than normal staircase-join */
-    ret->cost += ctx->cost + 5 * JOIN_COST;
-
     return ret;
 }
 


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to