diff options
author | Igor Babaev <igor@askmonty.org> | 2012-07-10 16:34:39 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2012-07-10 16:34:39 -0700 |
commit | 47fae7f08fd0437cd555bbd6b2533a4117340c8d (patch) | |
tree | eaa1b4c3e8c40420196ff94272d1fa2cd520039d /sql/sql_db.cc | |
parent | 4a6a08309cd78091246a7fd598bc43cd25deba45 (diff) | |
download | mariadb-git-47fae7f08fd0437cd555bbd6b2533a4117340c8d.tar.gz |
Added procedures to delete records by keys from statistical tables.
Now when a table is dropped the statistics on the table is removed
from the statistical tables. If the table is altered in such a way
that a column is dropped or the type of the column is changed then
statistics on the column is removed from the table column_stat.
It also triggers removal of the statistics on the indexes who use
this column as its component.
Added procedures that changes the names of the tables or columns
in the statistical tables for.
These procedures are used when tables/columns are renamed.
Also partly re-factored the code that introduced the persistent
statistical tables.
Added test cases into statistics.test to cover the new code.
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r-- | sql/sql_db.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 052616f6965..28565b02c1f 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -825,6 +825,17 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) lock_db_routines(thd, db)) goto exit; + if (!in_bootstrap) + { + for (table= tables; table; table= table->next_local) + { + LEX_STRING db_name= { table->db, table->db_length }; + LEX_STRING table_name= { table->table_name, table->table_name_length }; + if (table->open_type == OT_BASE_ONLY || !find_temporary_table(thd, table)) + (void) delete_statistics_for_table(thd, &db_name, &table_name); + } + } + /* mysql_ha_rm_tables() requires a non-null TABLE_LIST. */ if (tables) mysql_ha_rm_tables(thd, tables); |