Created
November 3, 2016 11:13
-
-
Save ottok/2df7e44d0acfc407f2710f554e02c627 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Author: Vicențiu Ciorbaru <[email protected]> 2016-09-19 21:45:30 | |
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 -------------------------------- | |
index cf9e99b..a5cfd05 100644 | |
@@ -8411,6 +8411,7 @@ int show_threadpool_idle_threads(THD *thd, SHOW_VAR *var, char *buff, | |
{"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}, | |
------------------------------- sql/sql_class.h ------------------------------- | |
index d2a489b..51642ec 100644 | |
@@ -789,6 +789,7 @@ enum killed_type | |
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 */ | |
------------------------------ sql/sql_select.cc ------------------------------ | |
index 1eaa1ce..761f6c4 100644 | |
@@ -2699,6 +2699,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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment