Update of /cvsroot/monetdb/sql/src/server
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv14693/src/server

Modified Files:
        sql_env.mx sql_mvc.mx sql_parser.mx sql_scan.mx 
Log Message:
Commit of the intermediate state of the new history scheme.
The 'patch' to SQL to produces 'times' results have been removed.
The hardwired code and expensive SQL call to update the history
table has been changed into a more open infrastructure that will
rely on an upcall to two SQL procedures that are in control
of filtering and archiving the performance information.

Platform dependent tests may require separate approval.

Stress testing the updates in a parallel (dataflow) setting
is one of the open issues, because some spurious bat leaks
where noticed by playing with the commands in the history.sql
file only.


U sql_mvc.mx
Index: sql_mvc.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_mvc.mx,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -d -r1.211 -r1.212
--- sql_mvc.mx  10 Oct 2008 09:00:13 -0000      1.211
+++ sql_mvc.mx  3 Nov 2008 15:32:04 -0000       1.212
@@ -55,10 +55,8 @@
 
 /* different query execution modifiers (emod) */
 #define mod_none 0
-#define mod_profile 1
 #define mod_debug 2
 #define mod_trace 4
-#define mod_record 8
 
 struct stmt;
 typedef struct sql_var {
@@ -99,6 +97,7 @@
        /* current session variables */
        int timezone;           /* minutes west of UTC */
        int cache;              /* some queries should not be cached ! */
+       int history;    /* queries statistics are kept  */
        int reply_size;         /* reply size */ 
        int debug;
 
@@ -277,6 +276,8 @@
 
                /* disable caching */
                m->cache = 0;
+               /* disable history */
+               m->history = 0;
                mvc_trans(m);
                s = m->session->schema = mvc_bind_schema(m, "sys");
                assert(m->session->schema != NULL);
@@ -307,7 +308,6 @@
 
                s = m->session->schema = mvc_bind_schema(m, "tmp");
                assert(m->session->schema != NULL);
-               sql_create_history(m, s);
 
                if (mvc_commit(m, 0, NULL) < 0) {
                        fprintf(stderr, "!mvc_init: unable to commit system 
tables\n");
@@ -590,6 +590,7 @@
        m->reply_size = 100;
        m->debug = debug;
        m->cache = 1;
+       m->history = 0;
 
        m->label = 0;
        m->cascade_action = NULL;
@@ -658,6 +659,9 @@
        if (m->cache != 1)
                stack_set_number(m, "cache", 1);
        m->cache = 1;
+       if (m->history != 0)
+               stack_set_number(m, "history", 0);
+       m->history = 0;
 
        m->label = 0;
        m->cascade_action = NULL;

U sql_scan.mx
Index: sql_scan.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_scan.mx,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- sql_scan.mx 10 Oct 2008 09:00:41 -0000      1.138
+++ sql_scan.mx 3 Nov 2008 15:32:04 -0000       1.139
@@ -313,7 +313,6 @@
 
        keywords_insert("EXPLAIN", SQL_EXPLAIN);
        keywords_insert("PLAN", SQL_PLAN);
-       keywords_insert("PROFILE", SQL_PROFILE);
        keywords_insert("RECORD", SQL_RECORD);
        keywords_insert("DEBUG", SQL_DEBUG);
        keywords_insert("TRACE", SQL_TRACE);

U sql_parser.mx
Index: sql_parser.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_parser.mx,v
retrieving revision 1.295
retrieving revision 1.296
diff -u -d -r1.295 -r1.296
--- sql_parser.mx       28 Oct 2008 20:05:04 -0000      1.295
+++ sql_parser.mx       3 Nov 2008 15:32:04 -0000       1.296
@@ -685,7 +685,7 @@
 %token CHECK CONSTRAINT CREATE
 %token TYPE PROCEDURE FUNCTION AGGREGATE RETURNS EXTERNAL sqlNAME DECLARE
 %token CALL LANGUAGE 
-%token SQL_EXPLAIN SQL_PLAN SQL_PROFILE SQL_RECORD SQL_DEBUG SQL_TRACE PREPARE 
EXECUTE
+%token SQL_EXPLAIN SQL_PLAN SQL_RECORD SQL_DEBUG SQL_TRACE PREPARE EXECUTE
 %token DEFAULT DISTINCT DROP
 %token FOREIGN
 %token PASSWORD GRANT REVOKE ROLE ADMIN INTO
@@ -746,27 +746,6 @@
        sql SCOLON      { mvc *m = (mvc*)parm;
                          m->sym = $$ = $3; YYACCEPT; 
                        }
- | SQL_PROFILE                 { mvc *m = (mvc*)parm;
-                         if (m->scanner.mode == LINE_1) {
-                               yyerror("We do not support profiling SQL in 
interactive mode");
-                               YYABORT;
-                         }
-                         m->emod |= mod_profile;
-                         m->scanner.as = m->scanner.yycur; 
-                         m->scanner.key = 0;
-#ifdef HAVE_TIMES      
-                         times(&m->times);
-#endif 
-                         m->Tstart = GDKusec();
-                       }
-   sqlstmt             { $$ = $3; YYACCEPT; }
- | SQL_RECORD          { mvc *m = (mvc*)parm;
-                         m->emod |= mod_record;
-                         m->scanner.as = m->scanner.yycur; 
-                         m->scanner.key = 0;
-                         m->Tparse = GDKusec();
-                       }
-   sqlstmt             { $$ = $3; YYACCEPT; }
  | SQL_DEBUG           { mvc *m = (mvc*)parm;
                          if (m->scanner.mode == LINE_1) {
                                yyerror("We only support debugging SQL in 
interactive mode");
@@ -4381,7 +4360,6 @@
 |  PREPARE     { $$ = sa_strdup(SA, "prepare"); }
 |  EXECUTE     { $$ = sa_strdup(SA, "execute"); }
 |  SQL_EXPLAIN { $$ = sa_strdup(SA, "explain"); }
-|  SQL_PROFILE { $$ = sa_strdup(SA, "profile"); }
 |  SQL_RECORD  { $$ = sa_strdup(SA, "record"); }
 |  SQL_DEBUG   { $$ = sa_strdup(SA, "debug"); }
 |  SQL_TRACE   { $$ = sa_strdup(SA, "trace"); }

U sql_env.mx
Index: sql_env.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_env.mx,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- sql_env.mx  10 Oct 2008 09:00:09 -0000      1.72
+++ sql_env.mx  3 Nov 2008 15:32:04 -0000       1.73
@@ -57,6 +57,7 @@
 extern int sql_create_env(mvc *sql, sql_schema *s);
 extern int sql_create_history(mvc *sql, sql_schema *tmp);
 
+
 #endif /* _SQL_ENV_H_ */
 @c
 #include "sql_config.h"
@@ -108,6 +109,10 @@
                sgn = stack_get_number(m, "cache");
                assert((lng) GDK_int_min <= sgn && sgn <= (lng) GDK_int_max);
                m->cache = (int) sgn;
+       } else if (strcmp(name, "history") == 0) {
+               sgn = stack_get_number(m, "history");
+               assert((lng) GDK_int_min <= sgn && sgn <= (lng) GDK_int_max);
+               m->history = (int) sgn;
        }
        return NULL;
 }
@@ -147,27 +152,4 @@
        list_destroy(l);
        return 0;
 }
-
[EMAIL PROTECTED]
-The 'history' table contains information on the parsing, optimization,
-and execution time. More detailed information should be obtained using
-the MonetDB kernel log, e.g. using Mknife
[EMAIL PROTECTED]
-
-int
-sql_create_history(mvc *m, sql_schema *s)
-{
-       sql_table *t = mvc_create_table(m, s, "history", 1, SQL_GLOBAL_TEMP, 
CA_PRESERVE, -1);
-
-       mvc_create_column_(m, t, "start", "timestamp", 0);
-       mvc_create_column_(m, t, "query", "varchar", 2048);
-       mvc_create_column_(m, t, "parse", "int", 32);
-       mvc_create_column_(m, t, "optimize", "int", 32);
-       mvc_create_column_(m, t, "exec", "int", 32);
-       mvc_create_column_(m, t, "total", "int", 32);
-       mvc_create_column_(m, t, "user", "varchar", 512);
-
-       return 0;
-}
-
 @}


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to