diff options
author | Igor Babaev <igor@askmonty.org> | 2012-12-13 23:05:12 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2012-12-13 23:05:12 -0800 |
commit | a06224bd1594ea1da650f748a8956922eafd2363 (patch) | |
tree | 99fc4c066ce8e3b9c0037333c62b993a787458d8 /sql/sql_statistics.h | |
parent | 65820439bdafeead66496b489c076012c334c710 (diff) | |
download | mariadb-git-a06224bd1594ea1da650f748a8956922eafd2363.tar.gz |
Addressed all remaining issues from the review of the patch
that introduced engine independent persistent statistics.
In particular:
- added an enumeration type for possible values of the system
variable use_stat_tables
- renamed KEY::real_rec_per_key to KEY::actual_rec_per_key
- optimized the collection of statistical data for any primary
key defined only on one column.
Diffstat (limited to 'sql/sql_statistics.h')
-rw-r--r-- | sql/sql_statistics.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sql/sql_statistics.h b/sql/sql_statistics.h index 14a16170c3b..e24e4beae74 100644 --- a/sql/sql_statistics.h +++ b/sql/sql_statistics.h @@ -25,6 +25,14 @@ generated automatically by the table definitions. */ +typedef +enum enum_use_stat_tables_mode +{ + NEVER, + COMPLEMENTARY, + PEFERABLY, +} Use_stat_tables_mode; + enum enum_stat_tables { TABLE_STAT, @@ -60,6 +68,27 @@ enum enum_index_stat_col INDEX_STAT_AVG_FREQUENCY }; +inline +Use_stat_tables_mode get_use_stat_tables_mode(THD *thd) +{ + return (Use_stat_tables_mode) (thd->variables.use_stat_tables); +} + +int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables); +int collect_statistics_for_table(THD *thd, TABLE *table); +int alloc_statistics_for_table_share(THD* thd, TABLE_SHARE *share, + bool is_safe); +int alloc_statistics_for_table(THD *thd, TABLE *table); +int update_statistics_for_table(THD *thd, TABLE *table); +int delete_statistics_for_table(THD *thd, LEX_STRING *db, LEX_STRING *tab); +int delete_statistics_for_column(THD *thd, TABLE *tab, Field *col); +int delete_statistics_for_index(THD *thd, TABLE *tab, KEY *key_info, + bool ext_prefixes_only); +int rename_table_in_stat_tables(THD *thd, LEX_STRING *db, LEX_STRING *tab, + LEX_STRING *new_db, LEX_STRING *new_tab); +int rename_column_in_stat_tables(THD *thd, TABLE *tab, Field *col, + const char *new_name); +void set_statistics_for_table(THD *thd, TABLE *table); class Columns_statistics; class Index_statistics; |