MySQL 8.0.40
Source Code Documentation
|
The class hold dynamic table statistics for a table. More...
#include <table_stats.h>
Public Member Functions | |
Table_statistics () | |
bool | is_stat_cached_in_mem (const String &db_name, const String &table_name, const char *partition_name) |
Check if the stats are cached for given db.table_name. More... | |
bool | is_stat_cached_in_mem (const String &db_name, const String &table_name) |
void | cache_stats_in_mem (const String &db_name, const String &table_name, const char *partition_name, handler *file) |
Store the statistics form the given handler. More... | |
void | cache_stats_in_mem (const String &db_name, const String &table_name, handler *file) |
void | cache_stats_in_mem (const String &db_name, const String &table_name, const char *partition_name, ha_statistics &stats) |
Store the statistics. More... | |
void | cache_stats_in_mem (const String &db_name, const String &table_name, ha_statistics &stats) |
ulonglong | read_stat (THD *thd, const String &schema_name_ptr, const String &table_name_ptr, const String &index_name_ptr, const char *partition_name, const String &column_name_ptr, uint index_ordinal_position, uint column_ordinal_position, const String &engine_name_ptr, dd::Object_id se_private_id, const char *ts_se_private_data, const char *tbl_se_private_data, const ulonglong &table_stat_data, const ulonglong &cached_time, enum_table_stats_type stype) |
Read dynamic table/index statistics from SE by opening the user table provided OR by reading cached statistics from Query_block. More... | |
ulonglong | read_stat (THD *thd, const String &schema_name_ptr, const String &table_name_ptr, const String &engine_name_ptr, const char *partition_name, dd::Object_id se_private_id, const char *ts_se_private_data, const char *tbl_se_private_data, const ulonglong &table_stat_data, const ulonglong &cached_time, enum_table_stats_type stype) |
void | invalidate_cache (void) |
String_type | error () |
void | store_error_message (const String &db_name, const String &table_name, const char *partition_name, const String_type &error_msg) |
Set error string for the given key. More... | |
bool | check_error_for_key (const String &db_name, const String &table_name) |
Check if we have seen a error. More... | |
bool | is_reading_stats_by_open () const |
Check if open table in progress. More... | |
bool | is_valid () const |
Predicate for determinig if cache is valid. More... | |
Public Attributes | |
ha_statistics | m_stats |
Private Member Functions | |
ulonglong | read_stat_from_SE (THD *thd, const String &schema_name_ptr, const String &table_name_ptr, const String &index_name_ptr, const String &column_name_ptr, uint index_ordinal_position, uint column_ordinal_position, dd::Object_id se_private_id, const char *ts_se_private_data, const char *tbl_se_private_data, enum_table_stats_type stype, handlerton *hton) |
Read dynamic table/index statistics from SE API's OR by reading cached statistics from Query_block. More... | |
ulonglong | read_stat_by_open_table (THD *thd, const String &schema_name_ptr, const String &table_name_ptr, const String &index_name_ptr, const char *partition_name, const String &column_name_ptr, uint column_ordinal_position, enum_table_stats_type stype) |
Read dynamic table/index statistics by opening the table OR by reading cached statistics from Query_block. More... | |
void | set_stat_cached (const String &db_name, const String &table_name, const char *partition_name) |
Mark the cache as valid for a given table. More... | |
void | set_stat_cached (const String &db_name, const String &table_name) |
String_type | form_key (const String &db_name, const String &table_name, const char *partition_name) |
Build a key representing the table for which stats are cached. More... | |
ulonglong | get_stat (ha_statistics &stat, enum_table_stats_type stype) |
Return statistics of the a given type. More... | |
ulonglong | get_stat (enum_table_stats_type stype) |
void | set_checksum (ulonglong &&checksum) |
Set checksum. More... | |
ulonglong | get_checksum () const |
Get checksum. More... | |
void | set_read_stats_by_open (bool status) |
Set open table in progress. More... | |
Private Attributes | |
String_type | m_key |
String_type | m_error |
ulonglong | m_checksum |
bool | m_read_stats_by_open |
The class hold dynamic table statistics for a table.
This cache is used by internal UDF's defined for the purpose of INFORMATION_SCHEMA queries which retrieve dynamic table statistics. The class caches statistics for just one table.
Overall aim of introducing this cache is to avoid making multiple calls to same SE API to retrieve the statistics.
|
inline |
|
inline |
Store the statistics.
db_name | - Schema name. |
table_name | - Table name. |
partition_name | - Partition name. |
stats | - ha_statistics of the table. |
|
inline |
Store the statistics form the given handler.
db_name | - Schema name. |
table_name | - Table name. |
partition_name | - Partition name. |
file | - Handler object for the table. |
|
inline |
|
inline |
|
inline |
Check if we have seen a error.
db_name | Database name. |
table_name | Table name. |
|
inline |
|
inlineprivate |
Build a key representing the table for which stats are cached.
db_name | - Database name. |
table_name | - Table name. |
partition_name | - Partition name. |
|
inlineprivate |
Get checksum.
|
inlineprivate |
|
private |
Return statistics of the a given type.
stat | ha_statistics for the current cached table. |
stype | Type of statistics requested. |
|
inline |
|
inline |
Check if open table in progress.
|
inline |
|
inline |
Check if the stats are cached for given db.table_name.
db_name | - Schema name. |
table_name | - Table name. |
partition_name | - Partition name. |
|
inline |
Predicate for determinig if cache is valid.
|
inline |
ulonglong dd::info_schema::Table_statistics::read_stat | ( | THD * | thd, |
const String & | schema_name_ptr, | ||
const String & | table_name_ptr, | ||
const String & | index_name_ptr, | ||
const char * | partition_name, | ||
const String & | column_name_ptr, | ||
uint | index_ordinal_position, | ||
uint | column_ordinal_position, | ||
const String & | engine_name_ptr, | ||
dd::Object_id | se_private_id, | ||
const char * | ts_se_private_data, | ||
const char * | tbl_se_private_data, | ||
const ulonglong & | table_stat_data, | ||
const ulonglong & | cached_time, | ||
enum_table_stats_type | stype | ||
) |
Read dynamic table/index statistics from SE by opening the user table provided OR by reading cached statistics from Query_block.
thd | - Current thread. |
schema_name_ptr | - Schema name of table. |
table_name_ptr | - Table name of which we need stats. |
index_name_ptr | - Index name of which we need stats. |
partition_name | - Partition name. |
column_name_ptr | - Column name for index. |
index_ordinal_position | - Ordinal position of index in table. |
column_ordinal_position | - Ordinal position of column in table. |
engine_name_ptr | - Engine of the table. |
se_private_id | - se_private_id of the table. |
ts_se_private_data | - Tablespace SE private data. |
tbl_se_private_data | - Table SE private data. |
table_stat_data | - Cached data from mysql.table_stats / mysql.index_stats table |
cached_time | - Timestamp value when data was cached. |
stype | - Enum specifying the stat we are interested to read. |
|
private |
Read dynamic table/index statistics by opening the table OR by reading cached statistics from Query_block.
thd | - Current thread. |
schema_name_ptr | - Schema name of table. |
table_name_ptr | - Table name of which we need stats. |
index_name_ptr | - Index name of which we need stats. |
column_name_ptr | - Column name for index. |
column_ordinal_position | - Ordinal position of column in table. |
partition_name | - Partition name. |
stype | - Enum specifying the stat we are interested to read. |
|
private |
Read dynamic table/index statistics from SE API's OR by reading cached statistics from Query_block.
thd | - Current thread. |
schema_name_ptr | - Schema name of table. |
table_name_ptr | - Table name of which we need stats. |
index_name_ptr | - Index name of which we need stats. |
column_name_ptr | - Column name for index. |
index_ordinal_position | - Ordinal position of index in table. |
column_ordinal_position | - Ordinal position of column in table. |
se_private_id | - se_private_id of the table. |
ts_se_private_data | - Tablespace SE private data. |
tbl_se_private_data | - Table SE private data. |
stype | - Enum specifying the stat we are interested to read. |
hton | - Handle to SE for the given table. |
|
inlineprivate |
Set checksum.
|
inlineprivate |
Set open table in progress.
|
inlineprivate |
|
inlineprivate |
Mark the cache as valid for a given table.
This creates a key for the cache element. We store just a single table statistics in this cache.
db_name | - Database name. |
table_name | - Table name. |
partition_name | - Partition name. |
|
inline |
Set error string for the given key.
The combination of (db, table and partition name) forms the key.
db_name | - Schema name. |
table_name | - Table name. |
partition_name | - Partition name. |
error_msg | - Error message. |
|
private |
|
private |
|
private |
|
private |
ha_statistics dd::info_schema::Table_statistics::m_stats |