Update of /cvsroot/monetdb/MonetDB5/src/optimizer
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19543
Modified Files:
opt_joinpath.mx
Log Message:
For sorted join operands we can make a more precise heuristic
based on the observation that often (in MonetDB/SQL) a selection
on a column is later used in a projection on the same column.
Index: opt_joinpath.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_joinpath.mx,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- opt_joinpath.mx 26 Feb 2008 16:11:07 -0000 1.24
+++ opt_joinpath.mx 28 Feb 2008 07:40:20 -0000 1.25
@@ -231,13 +231,14 @@
The join path optimizer takes a join sequence and
attempts to minimize the intermediate result.
The choice depends on a good estimate of intermediate
-results.
+results using properties.
For the time being, we use a simplistic model, based
on the assumption that most joins are foreign key joins anyway.
We use a sample based approach for sizeable tables.
The model is derived from the select statement. However, we did not succeed.
The code is now commented for future improvement.
+
Final conclusion from this exercise is:
The difference between the join input size and the join output size is not
the correct (or unique) metric which should be used to decide which order
@@ -249,12 +250,15 @@
ALGjoinCost(BAT *l, BAT *r)
{
size_t lc, rc;
-/* size_t lsize,rsize;
- BAT *lsample, *rsample, *j; */
+#if 0
+ size_t lsize,rsize;
+ BAT *lsample, *rsample, *j;
+#endif
lc = BATcount(l);
rc = BATcount(r);
#if 0
+ /* The sampling method */
if( lc > 100000 || rc > 100000){
lsize= MIN(lc/100, (1<<SAMPLE_THRESHOLD_lOG)/3);
lsample= BATsample(l,lsize);
@@ -268,6 +272,10 @@
return lsize;
}
#endif
+ /* merge joins are by far the cheapest */
+ if( l->tsorted && r->hsorted)
+ return MIN(lc,rc);
+ /* foreign key joins are common */
if( l->ttype== TYPE_oid || r->htype== TYPE_oid )
return MIN(lc,rc);
return lc * rc;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins