Update of /cvsroot/monetdb/pathfinder/compiler/algebra
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv31547/compiler/algebra
Modified Files:
Tag: M5XQ
logical.c
Log Message:
propagated changes of Monday Oct 05 2009
from the development trunk to the M5XQ branch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2009/10/05 - sjoerd: compiler/algebra/logical.c,1.127
propagated changes of Monday Sep 28 2009 - Monday Oct 05 2009
from the Aug2009_NFI branch to the development trunk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2009/09/28 - boncz: compiler/algebra/logical.c,1.126.6.1
optimizations for NFI XIRAF use case -- thanks a great bunch Jan R.!!
- ds_link (already in Stable) optimized for 1-node case
- indices now contain all data (but still not used automatically, nor based
on Lefteris' new indexing schemes)
most prominently though is: subexpression result caching
- caching hints in pragmas
- query enclosed in (# pf:session id:msec ) { query } or (# pf:session-use
id:msec ) { query }
+ queries in the same session use the same working set (documents opened
only once)
+ same working set allows to cache results
+ pf:session-use only uses cache, cannot add to it
- but, multiple pf:session-use can run concurrently; whereas pf:session
is exclusive
- inside a query, an arbitrary number of expressions can be marked up for
caching/reuse
+ (# pf:cache id ) { subexpr }
+ subexpr may not be enclosed by a for-loop
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
U logical.c
Index: logical.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/logical.c,v
retrieving revision 1.123.2.3
retrieving revision 1.123.2.4
diff -u -d -r1.123.2.3 -r1.123.2.4
--- logical.c 15 Jun 2009 12:44:05 -0000 1.123.2.3
+++ logical.c 5 Oct 2009 12:11:48 -0000 1.123.2.4
@@ -265,8 +265,9 @@
* or below a `rec_fix' operator if the side effects appear in the recursion
* body.
* The `side_effects' operator contains a (possibly empty) list of operations
- * that may trigger side effects (operators `error' and `trace') in its left
- * child and the fragment or recursion parameters in the right child.
+ * that may trigger side effects (operators `error', `cache' and `trace')
+ * in its left child and the fragment or recursion parameters in the right
+ * child.
*/
PFla_op_t *
PFla_side_effects (const PFla_op_t *side_effects, const PFla_op_t *params)
@@ -275,6 +276,7 @@
assert (side_effects);
assert (side_effects->kind == la_error ||
+ side_effects->kind == la_cache ||
side_effects->kind == la_trace ||
side_effects->kind == la_nil);
assert (params);
@@ -3616,6 +3618,40 @@
/**
+ * Constructor for a caching operator.
+ *
+ * This operator puts a query to the query cache (with the key in @a id).
+ */
+PFla_op_t *
+PFla_cache (const PFla_op_t *n1, const PFla_op_t *n2, char *id,
+ PFalg_col_t pos, PFalg_col_t item)
+{
+ PFla_op_t *ret;
+ unsigned int i;
+
+ assert(n1);
+
+ ret = la_op_wire2 (la_cache, n1, n2);
+
+ /* allocate memory for the result schema; it's the same schema as n's */
+ ret->schema.count = n2->schema.count;
+ ret->schema.items
+ = PFmalloc (ret->schema.count * sizeof (*(ret->schema.items)));
+
+ /* copy schema from argument 'n' */
+ for (i = 0; i < n2->schema.count; i++) {
+ ret->schema.items[i] = n2->schema.items[i];
+ }
+
+ ret->sem.cache.id = id;
+ ret->sem.cache.pos = pos;
+ ret->sem.cache.item = item;
+
+ return ret;
+}
+
+
+/**
* Constructor for a debug operator
*/
PFla_op_t *
@@ -4452,6 +4488,13 @@
case la_nil:
return PFla_nil ();
+ case la_cache:
+ return PFla_cache (left,
+ right,
+ n->sem.cache.id,
+ n->sem.cache.pos,
+ n->sem.cache.item);
+
case la_trace:
return PFla_trace (left, right);
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins