Update of /cvsroot/monetdb/pathfinder/compiler/include
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv15416/compiler/include
Modified Files:
Tag: Aug2009_NFI
algebra.h builtins.h compile_interface.h logical.h
logical_mnemonic.h mil.h mil_mnemonic.h milgen.h physical.h
physical_mnemonic.h
Log Message:
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 physical.h
Index: physical.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/physical.h,v
retrieving revision 1.56
retrieving revision 1.56.6.1
diff -u -d -r1.56 -r1.56.6.1
--- physical.h 12 Jun 2009 13:06:16 -0000 1.56
+++ physical.h 28 Sep 2009 23:20:25 -0000 1.56.6.1
@@ -110,8 +110,10 @@
, pa_content = 130 /**< constructor content operator (elem|doc) */
, pa_slim_content = 131 /**< shallow constructor content operator */
, pa_merge_adjacent = 132
- , pa_error = 139 /**< error operator */
- , pa_nil = 140 /**< end of the list of parameters */
+ , pa_error = 137 /**< error operator */
+ , pa_nil = 138 /**< end of the list of parameters */
+ , pa_cache = 139 /**< cache operator */
+ , pa_cache_border = 140 /**< cache border operator */
, pa_trace = 141 /**< debug operator */
, pa_trace_items = 142 /**< debug operator */
, pa_trace_msg = 143 /**< debug message operator */
@@ -333,6 +335,12 @@
PFalg_col_t col; /**< error: column of error message */
} err;
+ /* semantic content for cache operator */
+ struct {
+ char * id; /**< the cache id */
+ PFalg_col_t item; /**< item column */
+ } cache;
+
/* semantic content for debug relation map operator */
struct {
PFalg_col_t inner; /**< name of the inner column */
@@ -795,6 +803,17 @@
PFpa_op_t *PFpa_nil (void);
/**
+ * Constructor for cache operator
+ */
+PFpa_op_t * PFpa_cache (const PFpa_op_t *n1, const PFpa_op_t *n2,
+ char *id, PFalg_col_t item);
+
+/**
+ * Constructor for cache border operator
+ */
+PFpa_op_t * PFpa_cache_border (const PFpa_op_t *n);
+
+/**
* Constructor for debug operator
*/
PFpa_op_t * PFpa_trace (const PFpa_op_t *n1, const PFpa_op_t *n2);
U logical_mnemonic.h
Index: logical_mnemonic.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/logical_mnemonic.h,v
retrieving revision 1.42
retrieving revision 1.42.6.1
diff -u -d -r1.42 -r1.42.6.1
--- logical_mnemonic.h 12 Jun 2009 13:06:16 -0000 1.42
+++ logical_mnemonic.h 28 Sep 2009 23:20:25 -0000 1.42.6.1
@@ -202,6 +202,9 @@
/* duplicates a node with its given children */
#define duplicate(n, l, r) PFla_op_duplicate ((n), (l), (r))
+/* Constructor for cache operator */
+#define cache(a,b,c,d,e) PFla_cache ((a),(b),(c),(d),(e))
+
/* Constructor for debug operator */
#define trace(a,b) PFla_trace ((a),(b))
U milgen.h
Index: milgen.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/milgen.h,v
retrieving revision 1.12
retrieving revision 1.12.12.1
diff -u -d -r1.12 -r1.12.12.1
--- milgen.h 8 Jan 2009 16:54:12 -0000 1.12
+++ milgen.h 28 Sep 2009 23:20:25 -0000 1.12.12.1
@@ -40,7 +40,7 @@
#include "mil.h"
/** Generate MIL tree from algebra expression tree */
-PFmil_t *PFmilgen (PFpa_op_t *, char *genType);
+PFmil_t *PFmilgen (PFpa_op_t *, char *genType, char* qid, char* mode, long
long timeout);
#endif /* MILGEN_H */
U algebra.h
Index: algebra.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/algebra.h,v
retrieving revision 1.113
retrieving revision 1.113.6.1
diff -u -d -r1.113 -r1.113.6.1
--- algebra.h 12 Jun 2009 13:06:15 -0000 1.113
+++ algebra.h 28 Sep 2009 23:20:25 -0000 1.113.6.1
@@ -365,6 +365,7 @@
, alg_fun_call_xrpc /**< XRPC function call */
, alg_fun_call_xrpc_helpers /**< func call for XRPC helpers */
, alg_fun_call_tijah /**< Tijah function call */
+ , alg_fun_call_cache /**< caching function call */
};
typedef enum PFalg_fun_call_t PFalg_fun_call_t;
U mil_mnemonic.h
Index: mil_mnemonic.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/mil_mnemonic.h,v
retrieving revision 1.68
retrieving revision 1.68.10.1
diff -u -d -r1.68 -r1.68.10.1
--- mil_mnemonic.h 1 Apr 2009 13:25:18 -0000 1.68
+++ mil_mnemonic.h 28 Sep 2009 23:20:25 -0000 1.68.10.1
@@ -238,6 +238,8 @@
/** texist() function */
#define texist(a,b) PFmil_texist((a),(b))
+#define find(a,b) PFmil_find((a),(b))
+
/** max() operator */
#ifdef max
#undef max
@@ -343,6 +345,12 @@
/** Free an existing working set */
#define destroy_ws(ws) PFmil_destroy_ws (ws)
+#define end_ws(ws, err) PFmil_end_ws (ws, err)
+
+/** Get and put in the subexpr cache */
+#define cache_expr(ws, id) PFmil_cache_expr (ws, id)
+#define cache_get(ws, id) PFmil_cache_get (ws, id)
+#define cache_put(ws, id, val) PFmil_cache_put (ws, id, val)
/** positional multijoin with a working set `mposjoin (a, b, c)' */
#define mposjoin(a,b,c) PFmil_mposjoin ((a), (b), (c))
U physical_mnemonic.h
Index: physical_mnemonic.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/physical_mnemonic.h,v
retrieving revision 1.41
retrieving revision 1.41.6.1
diff -u -d -r1.41 -r1.41.6.1
--- physical_mnemonic.h 12 Jun 2009 13:06:16 -0000 1.41
+++ physical_mnemonic.h 28 Sep 2009 23:20:25 -0000 1.41.6.1
@@ -152,6 +152,8 @@
#define error(a,b,c) PFpa_error ((a), (b), (c))
#define nil() PFpa_nil ()
+#define cache(a,b,c,d) PFpa_cache ((a),(b),(c),(d))
+#define cache_border(a) PFpa_cache_border (a)
#define trace(a,b) PFpa_trace ((a),(b))
#define trace_items(a,b,c,d) PFpa_trace_items ((a),(b),(c),(d))
#define trace_msg(a,b,c,d) PFpa_trace_msg ((a), (b), (c), (d))
U mil.h
Index: mil.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/mil.h,v
retrieving revision 1.84
retrieving revision 1.84.10.1
diff -u -d -r1.84 -r1.84.10.1
--- mil.h 1 Apr 2009 13:25:18 -0000 1.84
+++ mil.h 28 Sep 2009 23:20:25 -0000 1.84.10.1
@@ -141,9 +141,10 @@
#define PF_MIL_VAR_XRPC_HDL 87
#define PF_MIL_VAR_XRPC_SEQNR 88
#define PF_MIL_VAR_XRPC_TIMEOUT 89
-#define PF_MIL_VAR_XRPC_MODE 90
-#define PF_MIL_VAR_XRPC_MODULE 91
-#define PF_MIL_VAR_XRPC_METHOD 92
+#define PF_MIL_VAR_XRPC_COORD 90
+#define PF_MIL_VAR_XRPC_MODE 91
+#define PF_MIL_VAR_XRPC_MODULE 92
+#define PF_MIL_VAR_XRPC_METHOD 93
#define PF_MIL_RES_VAR_COUNT (PF_MIL_VAR_XRPC_METHOD + 1)
@@ -238,6 +239,7 @@
, m_ctrefine_rev /**< MIL CTrefine_rev function */
, m_ctderive /**< MIL CTderive function */
, m_texist /**< MIL texist function */
+ , m_find /**< MIL find function */
, m_cast /**< typecast */
, m_mcast /**< multiplexed typecast */
@@ -304,6 +306,10 @@
, m_usec /**< Get the current time */
, m_new_ws /**< Create a new (empty) working set */
, m_destroy_ws /**< Free an existing working set */
+ , m_end_ws /**< Free an existing working set */
+ , m_cache_expr /**< check if a subexpr is already cached */
+ , m_cache_get /**< get cached subexpr */
+ , m_cache_put /**< store a new subexpr */
, m_mposjoin /**< Positional multijoin with a working set */
, m_mvaljoin /**< Multijoin with a working set */
, m_bat /**< MonetDB bat() function */
@@ -725,6 +731,9 @@
/** MIL texist function */
PFmil_t * PFmil_texist (const PFmil_t *, const PFmil_t *);
+/** MIL find function */
+PFmil_t * PFmil_find (const PFmil_t *, const PFmil_t *);
+
/** enumerate operator, return sequence of integers */
PFmil_t * PFmil_enumerate (const PFmil_t *, const PFmil_t *);
@@ -943,6 +952,11 @@
PFmil_t * PFmil_usec (void);
PFmil_t * PFmil_new_ws (const PFmil_t *);
PFmil_t * PFmil_destroy_ws (const PFmil_t *ws);
+PFmil_t * PFmil_end_ws (const PFmil_t *ws, const PFmil_t *err);
+PFmil_t * PFmil_cache_fnd (const PFmil_t *ws, const PFmil_t *id);
+PFmil_t * PFmil_cache_expr (const PFmil_t *ws, const PFmil_t *id);
+PFmil_t * PFmil_cache_get (const PFmil_t *ws, const PFmil_t *id);
+PFmil_t * PFmil_cache_put (const PFmil_t *ws, const PFmil_t *id, const PFmil_t
*val);
PFmil_t * PFmil_mposjoin (const PFmil_t *, const PFmil_t *, const PFmil_t *);
PFmil_t * PFmil_mvaljoin (const PFmil_t *, const PFmil_t *, const PFmil_t *);
U builtins.h
Index: builtins.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/builtins.h,v
retrieving revision 1.62
retrieving revision 1.62.10.1
diff -u -d -r1.62 -r1.62.10.1
--- builtins.h 1 Apr 2009 13:25:18 -0000 1.62
+++ builtins.h 28 Sep 2009 23:20:25 -0000 1.62.10.1
@@ -996,6 +996,11 @@
PFla_op_t **side_effects,
struct PFla_pair_t *args);
+struct PFla_pair_t PFbui_pf_query_cache (const PFla_op_t *loop,
+ bool ordering,
+ PFla_op_t **side_effects,
+ struct PFla_pair_t *args);
+
struct PFla_pair_t PFbui_pf_distinct_doc_order (const PFla_op_t *loop,
bool ordering,
PFla_op_t **side_effects,
U compile_interface.h
Index: compile_interface.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/compile_interface.h,v
retrieving revision 1.23
retrieving revision 1.23.12.1
diff -u -d -r1.23 -r1.23.12.1
--- compile_interface.h 8 Jan 2009 16:54:12 -0000 1.23
+++ compile_interface.h 28 Sep 2009 23:20:25 -0000 1.23.12.1
@@ -44,7 +44,7 @@
extern char* PFerrbuf;
/* main compiler call from the Monet runtime environment */
-char* PFcompile_MonetDB (char* xquery, char* url, char** prologue, char**
query, char** epilogue, int options, char *genType);
+char* PFcompile_MonetDB (char* xquery, char* url, char** prologue, char**
query, char** epilogue, int options, char *genType, char* qid, char* mode, long
long timeout);
/* get a document by URL (if not in cache, fetch it) */
char* PFurlcache(char *url, int keep);
U logical.h
Index: logical.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/logical.h,v
retrieving revision 1.69
retrieving revision 1.69.6.1
diff -u -d -r1.69 -r1.69.6.1
--- logical.h 12 Jun 2009 13:06:16 -0000 1.69
+++ logical.h 28 Sep 2009 23:20:25 -0000 1.69.6.1
@@ -148,8 +148,9 @@
union of fragments */
, la_empty_frag = 74 /**< representation of an empty fragment */
- , la_error = 79 /**< facility to trigger runtime errors */
- , la_nil = 80 /**< end of the list of parameters */
+ , la_error = 78 /**< facility to trigger runtime errors */
+ , la_nil = 79 /**< end of the list of parameters */
+ , la_cache = 80 /**< cache operator */
, la_trace = 81 /**< debug operator */
, la_trace_items = 82 /**< debug items operator */
, la_trace_msg = 83 /**< debug message operator */
@@ -426,6 +427,13 @@
PFalg_col_t col; /**< column of error message */
} err;
+ /* semantic content for cache operator */
+ struct {
+ char * id; /**< the cache id */
+ PFalg_col_t pos; /**< position column */
+ PFalg_col_t item; /**< item column */
+ } cache;
+
/* semantic content for debug relation map operator */
struct {
PFalg_col_t inner; /**< name of the inner column */
@@ -577,8 +585,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);
@@ -1134,6 +1143,15 @@
PFla_op_t *PFla_nil (void);
/**
+ * Constructor for a caching operator
+ */
+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);
+
+/**
* Constructor for debug operator
*/
PFla_op_t * PFla_trace (const PFla_op_t *n1,
------------------------------------------------------------------------------
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