Changeset: b023b4a73de6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b023b4a73de6
Modified Files:
        sql/src/server/rel_bin.c
        sql/src/server/rel_dump.c
        sql/src/server/rel_exp.c
        sql/src/server/rel_exp.h
        sql/src/server/rel_optimizer.c
        sql/src/server/rel_schema.c
        sql/src/server/rel_select.c
        sql/src/server/rel_semantic.c
Branch: default
Log Message:

Merged with Oct2010 branch.


diffs (truncated from 1431 to 300 lines):

diff -r aa6b6d90c1be -r b023b4a73de6 MonetDB/src/gdk/gdk_batop.mx
--- a/MonetDB/src/gdk/gdk_batop.mx      Wed Oct 20 18:31:29 2010 +0200
+++ b/MonetDB/src/gdk/gdk_batop.mx      Wed Oct 20 20:18:27 2010 +0200
@@ -445,7 +445,7 @@
        }
 
        b->batDirty = 1;
-       BATaccessBegin(b, USE_HHASH | USE_THASH, MMAP_SEQUENTIAL);
+       BATaccessBegin(b, USE_HHASH | USE_THASH, MMAP_WILLNEED);
        BATaccessBegin(n, USE_HEAD | USE_TAIL, MMAP_SEQUENTIAL);
 
        if (sz > BATcapacity(b) - BUNlast(b)) {
diff -r aa6b6d90c1be -r b023b4a73de6 MonetDB/src/gdk/gdk_relop.mx
--- a/MonetDB/src/gdk/gdk_relop.mx      Wed Oct 20 18:31:29 2010 +0200
+++ b/MonetDB/src/gdk/gdk_relop.mx      Wed Oct 20 20:18:27 2010 +0200
@@ -288,7 +288,10 @@
                return NULL;
        }
        BATaccessBegin(l, USE_HEAD | USE_TAIL, MMAP_SEQUENTIAL);
-       BATaccessBegin(r, USE_HEAD | USE_TAIL, r_scan > 0 ? MMAP_SEQUENTIAL : 
MMAP_WILLNEED);
+       /* use MMAP_WILLNEED only if random access is not too scattered, *
+        * i.e., only if number of lookups is more than 10% of inner BAT */
+       if (BATcount(l) > BATcount(r)/10)
+               BATaccessBegin(r, USE_HEAD | USE_TAIL, r_scan > 0 ? 
MMAP_SEQUENTIAL : MMAP_WILLNEED);
        if (bn == NULL) {
                
@:joinbat(JOIN_EQ,mergejoin(l,r,NULL,nil_on_miss,BUN_NONE,NULL),estimate)@
        }
@@ -366,7 +369,10 @@
        /* propagate properties */
       bunins_done:
        BATaccessEnd(l, USE_HEAD | USE_TAIL, MMAP_SEQUENTIAL);
-       BATaccessEnd(r, USE_HEAD | USE_TAIL, r_scan > 0 ? MMAP_SEQUENTIAL : 
MMAP_WILLNEED);
+       /* use MMAP_WILLNEED only if random access is not too scattered, *
+        * i.e., only if number of lookups is more than 10% of inner BAT */
+       if (BATcount(l) > BATcount(r)/10)
+               BATaccessEnd(r, USE_HEAD | USE_TAIL, r_scan > 0 ? 
MMAP_SEQUENTIAL : MMAP_WILLNEED);
        bn->hsorted = BAThordered(l);
        if (r->hkey) {
                if (BATcount(bn) == BATcount(l)) {
@@ -393,7 +399,10 @@
        return bn;
       bunins_failed:
        BATaccessEnd(l, USE_HEAD | USE_TAIL, MMAP_SEQUENTIAL);
-       BATaccessEnd(r, USE_HEAD | USE_TAIL, r_scan > 0 ? MMAP_SEQUENTIAL : 
MMAP_WILLNEED);
+       /* use MMAP_WILLNEED only if random access is not too scattered, *
+        * i.e., only if number of lookups is more than 10% of inner BAT */
+       if (BATcount(l) > BATcount(r)/10)
+               BATaccessEnd(r, USE_HEAD | USE_TAIL, r_scan > 0 ? 
MMAP_SEQUENTIAL : MMAP_WILLNEED);
        BBPreclaim(bn);
        return NULL;
 }
@@ -486,7 +495,10 @@
                return NULL;
        }
        BATaccessEnd(r, USE_HEAD, MMAP_SEQUENTIAL);
-       BATaccessBegin(r, USE_HEAD | USE_TAIL | USE_HHASH, MMAP_WILLNEED);
+       /* use MMAP_WILLNEED only if random access is not too scattered, *
+        * i.e., only if number of lookups is more than 10% of inner BAT */
+       if (BATcount(l) > BATcount(r)/10)
+               BATaccessBegin(r, USE_HEAD | USE_TAIL | USE_HHASH, 
MMAP_WILLNEED);
        switch (any = ATOMstorage(l->ttype)) {
 #ifndef NOEXPAND_CHR
        case TYPE_chr:
@@ -518,7 +530,10 @@
        default:
                @:hashjoin(atom,any,tail,any)@
        }
-       BATaccessEnd(r, USE_HEAD | USE_TAIL | USE_HHASH, MMAP_WILLNEED);
+       /* use MMAP_WILLNEED only if random access is not too scattered, *
+        * i.e., only if number of lookups is more than 10% of inner BAT */
+       if (BATcount(l) > BATcount(r)/10)
+               BATaccessEnd(r, USE_HEAD | USE_TAIL | USE_HHASH, MMAP_WILLNEED);
 
        /* propagate alignment info */
        bn->hsorted = BAThordered(l);
@@ -677,7 +692,10 @@
        ALGODEBUG THRprintf(GDKout, "#BATfetchjoin: 
defaultfetchjoin(@1,@2);\n");
 
        BATaccessBegin(l, USE_HEAD|USE_TAIL, MMAP_SEQUENTIAL);
-       BATaccessBegin(r, USE_TAIL, MMAP_WILLNEED);
+       /* use MMAP_WILLNEED only if random access is not too scattered, *
+        * i.e., only if number of lookups is more than 10% of inner BAT */
+       if (BATcount(l) > BATcount(r)/10)
+               BATaccessBegin(r, USE_TAIL, MMAP_WILLNEED);
        /*BATaccessBegin(bn, MMAP_SEQUENTIAL);*/
        BATloop(l, l_cur, l_end) {
                yy = (BUN) (offset + *(oid *) BUNtail(li, l_cur));
@@ -692,7 +710,10 @@
       goto bunins_failed;
       bunins_failed:
        BATaccessEnd(l, USE_HEAD|USE_TAIL, MMAP_SEQUENTIAL);
-       BATaccessEnd(r, USE_TAIL, MMAP_WILLNEED);
+       /* use MMAP_WILLNEED only if random access is not too scattered, *
+        * i.e., only if number of lookups is more than 10% of inner BAT */
+       if (BATcount(l) > BATcount(r)/10)
+               BATaccessEnd(r, USE_TAIL, MMAP_WILLNEED);
        /*BATaccessEnd(bn, MMAP_SEQUENTIAL);*/
        BATsetcount(bn, dst);
        if (!ret)
@@ -809,7 +830,9 @@
 @= defaultvoidfetchjoin
        ALGODEBUG THRprintf(GDKout, "#BATfetchjoin: 
defaultvoidfetchjoin(@1);\n");
        BATaccessBegin(l, USE_TAIL, MMAP_SEQUENTIAL);
-       if (BATcount(l) > (BATcount(r)/10)) 
+       /* use MMAP_WILLNEED only if random access is not too scattered, *
+        * i.e., only if number of lookups is more than 10% of inner BAT */
+       if (BATcount(l) > BATcount(r)/10) 
                BATaccessBegin(r, USE_TAIL, MMAP_WILLNEED);
        BATloop(l, l_cur, l_end) {
                BUN _yy = (BUN) (offset + * (oid *) BUNtloc(li, l_cur));
@@ -825,7 +848,9 @@
                dst++;
        }
        BATaccessEnd(l, USE_TAIL, MMAP_SEQUENTIAL);
-       if (BATcount(l) > (BATcount(r)/10)) 
+       /* use MMAP_WILLNEED only if random access is not too scattered, *
+        * i.e., only if number of lookups is more than 10% of inner BAT */
+       if (BATcount(l) > BATcount(r)/10) 
                BATaccessEnd(r, USE_TAIL, MMAP_WILLNEED);
        if (nondense) {
                BATiter bni; 
@@ -1518,7 +1543,10 @@
        BUN p, q;
        @4
 
-       BATaccessBegin(r, USE_HEAD|USE_TAIL|USE_HHASH, MMAP_WILLNEED);
+       /* use MMAP_WILLNEED only if random access is not too scattered, *
+        * i.e., only if number of lookups is more than 10% of inner BAT */
+       if (BATcount(l) > BATcount(r)/10)
+               BATaccessBegin(r, USE_HEAD|USE_TAIL|USE_HHASH, MMAP_WILLNEED);
        BATloop(l, p, q) {
                BUN i = 0;
 
@@ -1532,7 +1560,10 @@
                        @3(bn, s, BUNhead(li, p), nilt);
                }
        }
-       BATaccessEnd(r, USE_HEAD|USE_TAIL|USE_HHASH, MMAP_WILLNEED);
+       /* use MMAP_WILLNEED only if random access is not too scattered, *
+        * i.e., only if number of lookups is more than 10% of inner BAT */
+       if (BATcount(l) > BATcount(r)/10)
+               BATaccessEnd(r, USE_HEAD|USE_TAIL|USE_HHASH, MMAP_WILLNEED);
 }
 break;
 @
@@ -1596,7 +1627,10 @@
                bit nonil = TRUE;
                BUN p, q, w, s = BUNfirst(bn);
 
-               BATaccessBegin(r, USE_TAIL, BATtordered(l) & 1 ? 
MMAP_SEQUENTIAL : MMAP_WILLNEED);
+               /* use MMAP_WILLNEED only if random access is not too 
scattered, *
+                * i.e., only if number of lookups is more than 10% of inner 
BAT */
+               if (BATcount(l) > BATcount(r)/10)
+                       BATaccessBegin(r, USE_TAIL, BATtordered(l) & 1 ? 
MMAP_SEQUENTIAL : MMAP_WILLNEED);
                BATloop(l, p, q) {
                        oid v = *(oid *) BUNtail(li, p);
                        ptr t = nilt;
@@ -1610,7 +1644,10 @@
                        bunfastins_nocheck(bn, s, BUNhead(li, p), t, Hsize(bn), 
Tsize(bn));
                        s++;
                }
-               BATaccessEnd(r, USE_TAIL, BATtordered(l) & 1 ? MMAP_SEQUENTIAL 
: MMAP_WILLNEED);
+               /* use MMAP_WILLNEED only if random access is not too 
scattered, *
+                * i.e., only if number of lookups is more than 10% of inner 
BAT */
+               if (BATcount(l) > BATcount(r)/10)
+                       BATaccessEnd(r, USE_TAIL, BATtordered(l) & 1 ? 
MMAP_SEQUENTIAL : MMAP_WILLNEED);
                bn->tsorted = ((BATtordered(l) & BATtordered(r) & 1) && nonil) 
? GDK_SORTED : 0;
        } else {
                /* hash based algorithm (default) */
@@ -2010,7 +2047,10 @@
 
        if (cpy == l) {
                BATaccessBegin(l, USE_HEAD|USE_TAIL, MMAP_SEQUENTIAL);
-               BATaccessBegin(r, USE_HEAD, MMAP_WILLNEED);
+               /* use MMAP_WILLNEED only if random access is not too 
scattered, *
+                * i.e., only if number of lookups is more than 10% of inner 
BAT */
+               if (BATcount(l) > BATcount(r)/10)
+                       BATaccessBegin(r, USE_HEAD, MMAP_WILLNEED);
                BATloop(l, lp, lq) {
                        ptr v = b...@1(li, lp);
 
@@ -2019,10 +2059,16 @@
                        }
                }
                BATaccessEnd(l, USE_HEAD|USE_TAIL, MMAP_SEQUENTIAL);
-               BATaccessEnd(r, USE_HEAD, MMAP_WILLNEED);
+               /* use MMAP_WILLNEED only if random access is not too 
scattered, *
+                * i.e., only if number of lookups is more than 10% of inner 
BAT */
+               if (BATcount(l) > BATcount(r)/10)
+                       BATaccessEnd(r, USE_HEAD, MMAP_WILLNEED);
        } else {
                BATaccessBegin(l, USE_HEAD, MMAP_SEQUENTIAL);
-               BATaccessBegin(r, USE_HEAD|USE_TAIL, MMAP_WILLNEED);
+               /* use MMAP_WILLNEED only if random access is not too 
scattered, *
+                * i.e., only if number of lookups is more than 10% of inner 
BAT */
+               if (BATcount(l) > BATcount(r)/10)
+                       BATaccessBegin(r, USE_HEAD|USE_TAIL, MMAP_WILLNEED);
                BATloop(l, lp, lq) {
                        BUN rp, rq;
                        ptr v = b...@1(li, lp);
@@ -2034,7 +2080,10 @@
                        }
                }
                BATaccessEnd(l, USE_HEAD, MMAP_SEQUENTIAL);
-               BATaccessEnd(r, USE_HEAD|USE_TAIL, MMAP_WILLNEED);
+               /* use MMAP_WILLNEED only if random access is not too 
scattered, *
+                * i.e., only if number of lookups is more than 10% of inner 
BAT */
+               if (BATcount(l) > BATcount(r)/10)
+                       BATaccessEnd(r, USE_HEAD|USE_TAIL, MMAP_WILLNEED);
        }
 }
 break;
@@ -2139,7 +2188,10 @@
        if (merge) {
                ALGODEBUG THRprintf(GDKout, "#BATrevsemijoin: merge\n");
                BATaccessBegin(r, USE_HEAD, MMAP_SEQUENTIAL);
-               BATaccessBegin(l, USE_HEAD|USE_TAIL|USE_HHASH, MMAP_WILLNEED);
+               /* use MMAP_WILLNEED only if random access is not too 
scattered, *
+                * i.e., only if number of lookups is more than 10% of inner 
BAT */
+               if (BATcount(r) > BATcount(l)/10)
+                       BATaccessBegin(l, USE_HEAD|USE_TAIL|USE_HHASH, 
MMAP_WILLNEED);
                BATloop(r, rp, rq) {
                        v = b...@3(ri, rp);
 
@@ -2152,11 +2204,17 @@
                        }
                }
                BATaccessEnd(r, USE_HEAD, MMAP_SEQUENTIAL);
-               BATaccessEnd(l, USE_HEAD|USE_TAIL|USE_HHASH, MMAP_WILLNEED);
+               /* use MMAP_WILLNEED only if random access is not too 
scattered, *
+                * i.e., only if number of lookups is more than 10% of inner 
BAT */
+               if (BATcount(r) > BATcount(l)/10)
+                       BATaccessEnd(l, USE_HEAD|USE_TAIL|USE_HHASH, 
MMAP_WILLNEED);
        } else if (rdoubles) {
                ALGODEBUG THRprintf(GDKout, "#BATrevsemijoin: rdoubles\n");
                BATaccessBegin(r, USE_HEAD, MMAP_SEQUENTIAL);
-               BATaccessBegin(l, USE_HEAD|USE_TAIL|USE_HHASH, MMAP_WILLNEED);
+               /* use MMAP_WILLNEED only if random access is not too 
scattered, *
+                * i.e., only if number of lookups is more than 10% of inner 
BAT */
+               if (BATcount(r) > BATcount(l)/10)
+                       BATaccessBegin(l, USE_HEAD|USE_TAIL|USE_HHASH, 
MMAP_WILLNEED);
                BATloop(r, rp, rq) {
                        v = b...@3(ri, rp);
 
@@ -2170,10 +2228,16 @@
                        }
                }
                BATaccessEnd(r, USE_HEAD, MMAP_SEQUENTIAL);
-               BATaccessEnd(l, USE_HEAD|USE_TAIL|USE_HHASH, MMAP_WILLNEED);
+               /* use MMAP_WILLNEED only if random access is not too 
scattered, *
+                * i.e., only if number of lookups is more than 10% of inner 
BAT */
+               if (BATcount(r) > BATcount(l)/10)
+                       BATaccessEnd(l, USE_HEAD|USE_TAIL|USE_HHASH, 
MMAP_WILLNEED);
        } else {
                BATaccessBegin(r, USE_HEAD, MMAP_SEQUENTIAL);
-               BATaccessBegin(l, USE_HEAD|USE_TAIL|USE_HHASH, MMAP_WILLNEED);
+               /* use MMAP_WILLNEED only if random access is not too 
scattered, *
+                * i.e., only if number of lookups is more than 10% of inner 
BAT */
+               if (BATcount(r) > BATcount(l)/10)
+                       BATaccessBegin(l, USE_HEAD|USE_TAIL|USE_HHASH, 
MMAP_WILLNEED);
                BATloop(r, rp, rq) {
                        v = b...@3(ri, rp);
                        if (!...@1_eq(v, nil, @4)) {
@@ -2182,7 +2246,10 @@
                        }
                }
                BATaccessEnd(r, USE_HEAD, MMAP_SEQUENTIAL);
-               BATaccessEnd(l, USE_HEAD|USE_TAIL|USE_HHASH, MMAP_WILLNEED);
+               /* use MMAP_WILLNEED only if random access is not too 
scattered, *
+                * i.e., only if number of lookups is more than 10% of inner 
BAT */
+               if (BATcount(r) > BATcount(l)/10)
+                       BATaccessEnd(l, USE_HEAD|USE_TAIL|USE_HHASH, 
MMAP_WILLNEED);
        }
 }
 break;
@@ -2305,7 +2372,10 @@
 
        /* iterate l; positional fetch in r */
        BATaccessBegin(l, USE_HEAD | USE_TAIL, MMAP_SEQUENTIAL);
-       BATaccessBegin(r, USE_HEAD | USE_TAIL, BAThordered(l) & 1 ? 
MMAP_SEQUENTIAL : MMAP_WILLNEED);
+       /* use MMAP_WILLNEED only if random access is not too scattered, *
+        * i.e., only if number of lookups is more than 10% of inner BAT */
+       if (BATcount(l) > BATcount(r)/10)
+               BATaccessBegin(r, USE_HEAD | USE_TAIL, BAThordered(l) & 1 ? 
MMAP_SEQUENTIAL : MMAP_WILLNEED);
        BATloop(l, l_cur, l_end) {
                yy = (BUN) (offset + *(oid *) BUNhloc(li, l_cur));
                if (yy < base || yy >= end) {
@@ -2319,7 +2389,10 @@
                }
        }
        BATaccessEnd(l, USE_HEAD | USE_TAIL, MMAP_SEQUENTIAL);
-       BATaccessEnd(r, USE_HEAD | USE_TAIL, BAThordered(l) & 1 ? 
MMAP_SEQUENTIAL : MMAP_WILLNEED);
+       /* use MMAP_WILLNEED only if random access is not too scattered, *
+        * i.e., only if number of lookups is more than 10% of inner BAT */
+       if (BATcount(l) > BATcount(r)/10)
+               BATaccessEnd(r, USE_HEAD | USE_TAIL, BAThordered(l) & 1 ? 
MMAP_SEQUENTIAL : MMAP_WILLNEED);
 
        /* property propagation */
        bn->hsorted = (BAThordered(l) & BAThordered(r) & 1 ? GDK_SORTED : 
FALSE);
diff -r aa6b6d90c1be -r b023b4a73de6 MonetDB/src/gdk/gdk_setop.mx
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to