Changeset: 6e55ac43e39e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6e55ac43e39e
Modified Files:
        MonetDB/src/gdk/gdk_batop.mx
Branch: Oct2010
Log Message:

revive investment in building hash table with equi-/point-selects

In Feb2010, changeset b8f00f4a09a5 removed the feature to build
a hash-table on-the-fly with equi-/point-selects, given that we
do not know for aure, whether the investment indeed pays off,
i.e., whether more equi-/point-selects on the same BAT will follow.

With this checkin, we revive that feature.
However, we avoid the investment in cases where benefits, i.e.,
future equi-/point-selects on the same BAT, are unlikely, i.e.,
on transient BATs.
We also avoid the investments in cases where the general benefit
is unclear, i.e., in case the atom type is narrow (1 or 2 bytes),
and hence the respective domain rather small, and in case the
hash-table does not fit in memory.


diffs (21 lines):

diff -r f083f20f288e -r 6e55ac43e39e MonetDB/src/gdk/gdk_batop.mx
--- a/MonetDB/src/gdk/gdk_batop.mx      Sat Oct 02 09:45:01 2010 +0200
+++ b/MonetDB/src/gdk/gdk_batop.mx      Sat Oct 02 12:35:21 2010 +0200
@@ -1226,6 +1226,17 @@
                        ALGODEBUG THRprintf(GDKout, "#BAT_select_(b=%s): 
BAT_hashselect(b=%s, bn=%s, tl); (using existing hash-table)\n", BATgetId(b), 
BATgetId(b), BATgetId(bn));
 
                        bn = BAT_hashselect(b, bn, tl);
+               } else if (!preserve_order
+                               && equi
+                               && b->batPersistence == PERSISTENT
+                               && (size_t) ATOMsize(b->ttype) > sizeof(BUN) / 4
+                               && estimate < batcnt / 100
+                               && batcnt * (ATOMsize(b->ttype) + 2 * 
sizeof(BUN)) < (GDK_mem_maxsize / 2) /* MT_npages() * MT_pagesize() / 
GDKnr_threads */ ) {
+                       /* Build a hash-table on the fly for equi-select on 
persistent BAT
+                        * if tail-type is large (wide) and selectivity is low 
and BAT + hash-table fit in memory */
+                       ALGODEBUG THRprintf(GDKout, "#BAT_select_(b=%s): 
BAT_hashselect(b=%s, bn=%s, tl); (building hash-table on the fly)\n", 
BATgetId(b), BATgetId(b), BATgetId(bn));
+
+                       bn = BAT_hashselect(b, bn, tl);
                } else {
                        ALGODEBUG THRprintf(GDKout, "#BAT_select_(b=%s): 
BAT_scanselect(b=%s, bn=%s, tl, th, equi=%d, nequi=%d, lval=%d, hval=%d, 
nocheck=%d);\n", BATgetId(b), BATgetId(b), BATgetId(bn), equi, nequi, lval, 
hval, nocheck);
 
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to