diff options
author | Igor Babaev <igor@askmonty.org> | 2012-12-05 22:51:11 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2012-12-05 22:51:11 -0800 |
commit | dd119466c35d621d191d4d4ddcb578cb02420bdc (patch) | |
tree | 518ab13e2d7a160c82745c348f27c4b1253f8ee7 /sql/sql_admin.cc | |
parent | 81563081e5fb6f016d5be845af55234869a5fb61 (diff) | |
download | mariadb-git-dd119466c35d621d191d4d4ddcb578cb02420bdc.tar.gz |
Addressed the following issues from the review of the patch:
1. The PERSISTENT FOR clause of the ANALYZE command overrides
the setting of the system variable use_stat_tables:
with this clause ANALYZE unconditionally collects persistent
statistics.
2. ANALYZE collects persistent statistics only for tables of
the USER category. So it never collects persistent statistics
for system tables.
Diffstat (limited to 'sql/sql_admin.cc')
-rw-r--r-- | sql/sql_admin.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index 6044207eeaa..f2124dd3bb8 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -650,6 +650,12 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, TABLE *tab= table->table; Field **field_ptr= tab->field; + if (lex->with_persistent_for_clause && + tab->s->table_category != TABLE_CATEGORY_USER) + { + compl_result_code= result_code= HA_ADMIN_INVALID; + } + if (!lex->column_list) { uint fields= 0; @@ -711,7 +717,9 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, if (compl_result_code == HA_ADMIN_OK && operator_func == &handler::ha_analyze && - thd->variables.use_stat_tables > 0) + table->table->s->table_category == TABLE_CATEGORY_USER && + (thd->variables.use_stat_tables > 0 || + lex->with_persistent_for_clause)) { if (!(compl_result_code= alloc_statistics_for_table(thd, table->table)) && |