MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dict0stats.h File Reference
#include "univ.i"
#include "db0err.h"
#include "dict0types.h"
#include "trx0types.h"
#include "dict0stats.ic"
Include dependency graph for dict0stats.h:
This graph shows which files directly or indirectly include this file:

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

Detailed Description

Code used for calculating and manipulating table statistics.

Created Jan 06, 2010 Vasil Dimov

Definition in file dict0stats.h.

Function Documentation

UNIV_INLINE ibool dict_stats_auto_recalc_is_enabled ( const dict_table_t table)

Check whether auto recalc is enabled for a given table.

Returns
TRUE if enabled, FALSE otherwise in: table

Here is the caller graph for this function:

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

Parameters
tablein/out: table
auto_recalc_onin: explicitly enabled

Here is the caller graph for this function:

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.

Parameters
tablein/out: table

Here is the caller graph for this function:

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.

Returns
DB_SUCCESS or error code in: size of the errstr buffer

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.

Returns
DB_SUCCESS or error code
Parameters
db_and_tablein: db and table, e.g. 'db/table'
inamein: index name
errstrout: error message if != DB_SUCCESS is returned
errstr_szin: size of the errstr buffer

Definition at line 3134 of file dict0stats.cc.

Here is the call graph for this function:

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.

Returns
DB_SUCCESS or error code in: size of errstr buffer

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.

Returns
DB_SUCCESS or error code
Parameters
db_and_tablein: db and table, e.g. 'db/table'
errstrout: error message if != DB_SUCCESS is returned
errstr_szin: size of errstr buffer

Definition at line 3296 of file dict0stats.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the caller graph for this function:

UNIV_INLINE ibool dict_stats_is_persistent_enabled ( const dict_table_t table)

Check whether persistent statistics is enabled for a given table.

Returns
TRUE if enabled, FALSE otherwise
Parameters
tablein: table

Here is the caller graph for this function:

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.

Returns
DB_SUCCESS or error code in: errstr size

Renames a table in InnoDB persistent stats storage. This function creates its own transaction and commits it.

Returns
DB_SUCCESS or error code
Parameters
old_namein: old name, e.g. 'db/table'
new_namein: new name, e.g. 'db/table'
errstrout: error string if != DB_SUCCESS is returned
errstr_szin: errstr size

Definition at line 3464 of file dict0stats.cc.

Here is the call graph for this function:

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.

Parameters
tablein/out: table
ps_onin: persistent stats explicitly enabled
ps_offin: persistent stats explicitly disabled

Here is the caller graph for this function:

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.

Returns
DB_* error code or DB_SUCCESS in: whether to (re) calc the stats or to fetch them from the persistent storage

Calculates new estimates for table and index statistics. The statistics are used in query optimization.

Returns
DB_SUCCESS or error code
Parameters
tablein/out: table
stats_upd_optionin: whether to (re) calc the stats or to fetch them from the persistent statistics storage

Definition at line 2894 of file dict0stats.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void dict_stats_update_for_index ( dict_index_t index)

Fetches or calculates new estimates for index statistics.

Parameters
indexin/out: index

Definition at line 2846 of file dict0stats.cc.

Here is the call graph for this function:

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.

Parameters
tablein/out: table

Definition at line 834 of file dict0stats.cc.

Here is the call graph for this function:

Here is the caller graph for this function: