MySQL 5.6.14 Source Code Document
|
#include "univ.i"
#include "db0err.h"
#include "dict0types.h"
#include "trx0types.h"
#include "dict0stats.ic"
Go to the source code of this file.
Enumerations | |
enum | dict_stats_upd_option_t { DICT_STATS_RECALC_PERSISTENT, DICT_STATS_RECALC_TRANSIENT, DICT_STATS_EMPTY_TABLE, DICT_STATS_FETCH_ONLY_IF_NOT_IN_MEMORY } |
Functions | |
UNIV_INTERN void | dict_stats_update_transient (dict_table_t *table) |
UNIV_INLINE void | dict_stats_set_persistent (dict_table_t *table, ibool ps_on, ibool ps_off) __attribute__((nonnull)) |
UNIV_INLINE ibool | dict_stats_is_persistent_enabled (const dict_table_t *table) __attribute__((nonnull |
UNIV_INLINE void | dict_stats_auto_recalc_set (dict_table_t *table, ibool auto_recalc_on, ibool auto_recalc_off) |
UNIV_INLINE ibool | dict_stats_auto_recalc_is_enabled (const dict_table_t *table) |
UNIV_INLINE void | dict_stats_init (dict_table_t *table) |
UNIV_INLINE void | dict_stats_deinit (dict_table_t *table) __attribute__((nonnull)) |
UNIV_INTERN dberr_t | dict_stats_update (dict_table_t *table, dict_stats_upd_option_t stats_upd_option) |
UNIV_INTERN dberr_t | dict_stats_drop_index (const char *tname, const char *iname, char *errstr, ulint errstr_sz) |
UNIV_INTERN dberr_t | dict_stats_drop_table (const char *table_name, char *errstr, ulint errstr_sz) |
UNIV_INTERN void | dict_stats_update_for_index (dict_index_t *index) __attribute__((nonnull)) |
UNIV_INTERN dberr_t | dict_stats_rename_table (const char *old_name, const char *new_name, char *errstr, size_t errstr_sz) |
Variables | |
UNIV_INLINE ibool | warn_unused_result |
Code used for calculating and manipulating table statistics.
Created Jan 06, 2010 Vasil Dimov
Definition in file dict0stats.h.
UNIV_INLINE ibool dict_stats_auto_recalc_is_enabled | ( | const dict_table_t * | table | ) |
Check whether auto recalc is enabled for a given table.
UNIV_INLINE void dict_stats_auto_recalc_set | ( | dict_table_t * | table, |
ibool | auto_recalc_on, | ||
ibool | auto_recalc_off | ||
) |
Set the auto recalc flag for a given table (only honored for a persistent stats enabled table). The flag is set only in the in-memory table object and is not saved in InnoDB files. It will be read from the .frm file upon first open from MySQL after a server restart. in: explicitly disabled
table | in/out: table |
auto_recalc_on | in: explicitly enabled |
UNIV_INLINE void dict_stats_deinit | ( | dict_table_t * | table | ) |
Deinitialize table's stats after the last close of the table. This is used to detect "FLUSH TABLE" and refresh the stats upon next open.
table | in/out: table |
UNIV_INTERN dberr_t dict_stats_drop_index | ( | const char * | db_and_table, |
const char * | iname, | ||
char * | errstr, | ||
ulint | errstr_sz | ||
) |
Removes the information for a particular index's stats from the persistent storage if it exists and if there is data stored for this index. This function creates its own trx and commits it.
Removes the information for a particular index's stats from the persistent storage if it exists and if there is data stored for this index. This function creates its own trx and commits it. A note from Marko why we cannot edit user and sys_* tables in one trx: marko: The problem is that ibuf merges should be disabled while we are rolling back dict transactions. marko: If ibuf merges are not disabled, we need to scan the *.ibd files. But we shouldn't open *.ibd files before we have rolled back dict transactions and opened the SYS_* records for the *.ibd files.
db_and_table | in: db and table, e.g. 'db/table' |
iname | in: index name |
errstr | out: error message if != DB_SUCCESS is returned |
errstr_sz | in: size of the errstr buffer |
Definition at line 3134 of file dict0stats.cc.
UNIV_INTERN dberr_t dict_stats_drop_table | ( | const char * | db_and_table, |
char * | errstr, | ||
ulint | errstr_sz | ||
) |
Removes the statistics for a table and all of its indexes from the persistent storage if it exists and if there is data stored for the table. This function creates its own transaction and commits it.
Removes the statistics for a table and all of its indexes from the persistent statistics storage if it exists and if there is data stored for the table. This function creates its own transaction and commits it.
db_and_table | in: db and table, e.g. 'db/table' |
errstr | out: error message if != DB_SUCCESS is returned |
errstr_sz | in: size of errstr buffer |
Definition at line 3296 of file dict0stats.cc.
UNIV_INLINE void dict_stats_init | ( | dict_table_t * | table | ) |
Initialize table's stats for the first time when opening a table. in/out: table
UNIV_INLINE ibool dict_stats_is_persistent_enabled | ( | const dict_table_t * | table | ) |
Check whether persistent statistics is enabled for a given table.
table | in: table |
UNIV_INTERN dberr_t dict_stats_rename_table | ( | const char * | old_name, |
const char * | new_name, | ||
char * | errstr, | ||
size_t | errstr_sz | ||
) |
Renames a table in InnoDB persistent stats storage. This function creates its own transaction and commits it.
Renames a table in InnoDB persistent stats storage. This function creates its own transaction and commits it.
old_name | in: old name, e.g. 'db/table' |
new_name | in: new name, e.g. 'db/table' |
errstr | out: error string if != DB_SUCCESS is returned |
errstr_sz | in: errstr size |
Definition at line 3464 of file dict0stats.cc.
UNIV_INLINE void dict_stats_set_persistent | ( | dict_table_t * | table, |
ibool | ps_on, | ||
ibool | ps_off | ||
) |
Set the persistent statistics flag for a given table. This is set only in the in-memory table object and is not saved on disk. It will be read from the .frm file upon first open from MySQL after a server restart.
table | in/out: table |
ps_on | in: persistent stats explicitly enabled |
ps_off | in: persistent stats explicitly disabled |
UNIV_INTERN dberr_t dict_stats_update | ( | dict_table_t * | table, |
dict_stats_upd_option_t | stats_upd_option | ||
) |
Calculates new estimates for table and index statistics. The statistics are used in query optimization.
Calculates new estimates for table and index statistics. The statistics are used in query optimization.
table | in/out: table |
stats_upd_option | in: whether to (re) calc the stats or to fetch them from the persistent statistics storage |
Definition at line 2894 of file dict0stats.cc.
UNIV_INTERN void dict_stats_update_for_index | ( | dict_index_t * | index | ) |
Fetches or calculates new estimates for index statistics.
index | in/out: index |
Definition at line 2846 of file dict0stats.cc.
UNIV_INTERN void dict_stats_update_transient | ( | dict_table_t * | table | ) |
Calculates new estimates for table and index statistics. This function is relatively quick and is used to calculate transient statistics that are not saved on disk. This was the only way to calculate statistics before the Persistent Statistics feature was introduced. in/out: table
Calculates new estimates for table and index statistics. This function is relatively quick and is used to calculate transient statistics that are not saved on disk. This was the only way to calculate statistics before the Persistent Statistics feature was introduced.
table | in/out: table |
Definition at line 834 of file dict0stats.cc.