[Commits] 04e5138: Add a counter for the number of select statements using window functions

Vicentiu Ciorbaru vicentiu at mariadb.org
Mon Sep 19 21:47:05 EEST 2016


revision-id: 04e5138cb17b2adf2e61307d179de644816cbffa (mariadb-10.1.8-255-g04e5138)
parent(s): d34e2baa76bc767e2bca8695005ad1238376e9fd
author: Vicențiu Ciorbaru
committer: Vicențiu Ciorbaru
timestamp: 2016-09-19 20:45:30 +0200
message:

Add a counter for the number of select statements using window functions

The counter is available via SHOW [GLOBAL] STATUS and will be reported
by the feedback plugin.

---
 sql/mysqld.cc     | 1 +
 sql/sql_class.h   | 1 +
 sql/sql_select.cc | 2 ++
 3 files changed, 4 insertions(+)

diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 6858759..d02ddcd 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -8412,6 +8412,7 @@ SHOW_VAR status_vars[]= {
   {"Feature_subquery",         (char*) offsetof(STATUS_VAR, feature_subquery), SHOW_LONG_STATUS},
   {"Feature_timezone",         (char*) offsetof(STATUS_VAR, feature_timezone), SHOW_LONG_STATUS},
   {"Feature_trigger",          (char*) offsetof(STATUS_VAR, feature_trigger), SHOW_LONG_STATUS},
+  {"Feature_window_functions", (char*) offsetof(STATUS_VAR, feature_window_functions), SHOW_LONG_STATUS},
   {"Feature_xml",              (char*) offsetof(STATUS_VAR, feature_xml), SHOW_LONG_STATUS},
   {"Flush_commands",           (char*) &show_flush_commands, SHOW_SIMPLE_FUNC},
   {"Handler_commit",           (char*) offsetof(STATUS_VAR, ha_commit_count), SHOW_LONG_STATUS},
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 7cad0fa..33e0d07 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -787,6 +787,7 @@ typedef struct system_status_var
   ulong feature_timezone;	    /* +1 when XPATH is used */
   ulong feature_trigger;	    /* +1 opening a table with triggers */
   ulong feature_xml;		    /* +1 when XPATH is used */
+  ulong feature_window_functions;   /* +1 when window functions are used */
 
   /* From MASTER_GTID_WAIT usage */
   ulonglong master_gtid_wait_timeouts;          /* Number of timeouts */
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 2f6ac084..9c03447 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2681,6 +2681,8 @@ bool JOIN::make_aggr_tables_info()
     if (curr_tab->window_funcs_step->setup(thd, &select_lex->window_funcs,
                                            curr_tab))
       DBUG_RETURN(true);
+    /* Count that we're using window functions. */
+    status_var_increment(thd->status_var.feature_window_functions);
   }
 
   fields= curr_fields_list;


More information about the commits mailing list