InnoDB Plugin  1.0
Enumerations | Functions
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))
UNIV_INLINE ibool dict_stats_is_persistent_enabled (const dict_table_t *table))
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))
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))
UNIV_INTERN dberr_t dict_stats_rename_table (const char *old_name, const char *new_name, char *errstr, size_t errstr_sz)

Detailed Description

Code used for calculating and manipulating table statistics.

Created Jan 06, 2010 Vasil Dimov

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

Check whether auto recalc is enabled for a given table.

Returns
TRUE if enabled, FALSE otherwise
Parameters
tablein: 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

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.

Parameters
tablein/out: table
auto_recalc_onin: explicitly enabled
auto_recalc_offin: explicitly disabled
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
UNIV_INTERN dberr_t dict_stats_drop_index ( const char *  tname,
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
Parameters
tnamein: table name
inamein: index name
errstrout: error message if != DB_SUCCESS is returned
UNIV_INTERN dberr_t dict_stats_drop_table ( const char *  table_name,
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
Parameters
table_namein: table name
errstrout: error message if != DB_SUCCESS is returned
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

Initialize table's stats for the first time when opening a table.

Parameters
tablein/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.

Returns
TRUE if enabled, FALSE otherwise
Parameters
tablein: 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.

Returns
DB_SUCCESS or error code in: errstr size
Parameters
old_namein: old table name
new_namein: new table name
errstrout: error string if != DB_SUCCESS is returned
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
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
Parameters
tablein/out: table
UNIV_INTERN void dict_stats_update_for_index ( dict_index_t index)

Fetches or calculates new estimates for index statistics.

Parameters
indexin/out: index
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