diff options
author | unknown <sanja@askmonty.org> | 2013-10-04 08:33:09 +0300 |
---|---|---|
committer | unknown <sanja@askmonty.org> | 2013-10-04 08:33:09 +0300 |
commit | 2f4db5348a43dea3ba21831955d0a029140d797c (patch) | |
tree | c99adb52d311673363c2b704acd7a4f19ce55d89 /sql | |
parent | eae0a45f4e5ed4f1e382e53be74dd8082d4d797a (diff) | |
download | mariadb-git-2f4db5348a43dea3ba21831955d0a029140d797c.tar.gz |
MDEV-4981: Account for queries handled by query-cache in USER_STATISTICS (and in HOST_STATISTICS)
Added collection statistics for queries resolved via query cache.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_cache.cc | 6 | ||||
-rw-r--r-- | sql/sql_parse.cc | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 99baa70070e..2e9a183ce63 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -2074,9 +2074,13 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d", } #endif /*!EMBEDDED_LIBRARY*/ - thd->limit_found_rows = query->found_rows(); + thd->sent_row_count= thd->limit_found_rows = query->found_rows(); thd->status_var.last_query_cost= 0.0; thd->query_plan_flags= (thd->query_plan_flags & ~QPLAN_QC_NO) | QPLAN_QC; + if (!thd->sent_row_count) + status_var_increment(thd->status_var.empty_queries); + else + status_var_add(thd->status_var.rows_sent, thd->sent_row_count); /* End the statement transaction potentially started by an diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index cfd31ada888..49b8cde386a 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4656,7 +4656,8 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables) /* Count number of empty select queries */ if (!thd->sent_row_count) status_var_increment(thd->status_var.empty_queries); - status_var_add(thd->status_var.rows_sent, thd->sent_row_count); + else + status_var_add(thd->status_var.rows_sent, thd->sent_row_count); return res; } @@ -5790,6 +5791,8 @@ void mysql_parse(THD *thd, char *rawbuf, uint length, { /* Update statistics for getting the query from the cache */ thd->lex->sql_command= SQLCOM_SELECT; + status_var_increment(thd->status_var.com_stat[thd->lex->sql_command]); + thd->update_stats(); } DBUG_VOID_RETURN; } |