MySQL 9.1.0
Source Code Documentation
|
Performance schema instrumentation (declarations). More...
#include <sys/types.h>
#include "my_psi_config.h"
#include "my_inttypes.h"
#include "my_macros.h"
#include "mysql/psi/psi_statement.h"
#include "sql/sql_digest.h"
Go to the source code of this file.
Macros | |
#define | PSI_STATEMENT_CALL(M) pfs_##M##_vc |
#define | PSI_DIGEST_CALL(M) pfs_##M##_vc |
#define | PSI_PS_CALL(M) pfs_##M##_vc |
Performance schema instrumentation (declarations).
PSI_prepared_stmt * pfs_create_prepared_stmt_vc | ( | void * | identity, |
uint | stmt_id, | ||
PSI_statement_locker * | locker, | ||
const char * | stmt_name, | ||
size_t | stmt_name_length, | ||
const char * | sql_text, | ||
size_t | sql_text_length | ||
) |
void pfs_destroy_prepared_stmt_vc | ( | PSI_prepared_stmt * | prepared_stmt | ) |
void pfs_digest_end_vc | ( | PSI_digest_locker * | locker, |
const sql_digest_storage * | digest | ||
) |
PSI_digest_locker * pfs_digest_start_vc | ( | PSI_statement_locker * | locker | ) |
void pfs_end_statement_vc | ( | PSI_statement_locker * | locker, |
void * | stmt_da | ||
) |
void pfs_execute_prepared_stmt_vc | ( | PSI_statement_locker * | locker, |
PSI_prepared_stmt * | ps | ||
) |
PSI_statement_locker * pfs_get_thread_statement_locker_vc | ( | PSI_statement_locker_state * | state, |
PSI_statement_key | key, | ||
const void * | charset, | ||
PSI_sp_share * | sp_share | ||
) |
This is the entry point to the performance schema statement instrumentation.
This instrumentation is used to:
These two data paths are executed in parallel, based on data collected once, and possibly used twice for different purposes.
is used to collect data.
How each field in PSI_statement_locker_state is used is described here, not in PSI_statement_locker_state, because usage is specific to the implementation.
Other instrumentations of the PSI interface, (namely, LOCK_ORDER), may choose to use fields differently, or not at all.
Fields in PSI_statement_locker_state are used as follows.
PSI_statement_locker_state::m_class
Statement instrument class. Always populated. Not null.
PSI_statement_locker_state::m_cs_number
Always populated. Character set number, for query text.
PSI_statement_locker_state::m_thread
Thread instrumentation. Always populated. May be null.
PSI_statement_locker_state::m_parent_sp_share
Parent stored program instrumentation. Always populated. May be null.
PSI_statement_locker_state::m_pfs_flags
Flags controlling how collected data is used to feed performance schema tables. Always populated.
Bits have the following semantic:
In addition, the following filters are implemented:
PSI_statement_locker_state::m_telemetry_scope
These flags are set by the telemetry traces component, to indicate if/how to collect data for telemetry. Never populated, when not compiling with telemetry. Always populated, when compiling with telemetry.
Possible values are:
0
, to indicate statement traces are not collected.TRACE_STATEMENTS
, to indicate statement traces are required.These values are exposed in the mysql_server_telemetry_traces_v1 service, and part of the public mysql_server_telemetry_traces interface.
Subsequent calls to telemetry trace apis can narrow down flags, but can never add more flags.
PSI_statement_locker_state::m_tel_flags
These flags are a translation, in performance schema implementation terms, of interface PSI_statement_locker_state::m_telemetry_scope. Never populated, when not compiling with telemetry traces. Always populated, when compiling with telemetry traces.
Bits have the following semantic:
In practice, these flags are not set individually. See STATE_FLAG_STATEMENT_TELEMETRY.
PSI_statement_locker_state::m_collect_flags
Flags controlling data collection. These flags are the union of m_pfs_flags
and m_telemetry_scope
Always populated.
A value 0 indicates nothing is collected.
PSI_statement_locker_state::m_telemetry_locker
Opaque pointer to a telemetry span inside the telemetry component. Never populated, when not compiling with telemetry. Always populated, when compiling with telemetry. May be NULL.
PSI_statement_locker_state::m_telemetry
Pointer to the telemetry traces component code.
Typed as a void* pointer in public headers, to avoid exposing implementation details. The effective type is guaranteed to be
which is the component entry point loaded by INSTALL COMPONENT <telemetry.so>
Never populated, when not compiling with telemetry traces. Conditionally populated, when compiling with telemetry traces. Not NULL if populated.
This member is initialized only when m_telemetry_locker != nullptr. It points to the telemetry traces component that created the m_telemetry_locker.
When m_telemetry_locker == nullptr, this member is not set.
PSI_statement_locker_state::m_telemetry_session
Pointer to a telemetry session, inside the telemetry component.
Never populated, when not compiling with telemetry traces. Conditionally populated, when compiling with telemetry traces. Not NULL if populated.
This member is initialized only when m_telemetry_locker != nullptr. It points to the telemetry session associated with the m_telemetry_locker.
When m_telemetry_locker == nullptr, this member is not set.
PSI_statement_locker_state::m_controlled_local_size_start
PSI_statement_locker_state::m_controlled_stmt_size_start
PSI_statement_locker_state::m_total_local_size_start
PSI_statement_locker_state::m_total_stmt_size_start
Temporary storage used by the instrumentation to compute the amount of memory used by a sub statement.
Conditionally populated, several conditions apply:
Used to compute MAX_CONTROLLED_MEMORY and MAX_TOTAL_MEMORY.
PSI_statement_locker_state::m_timer_start
Statement timing information. Conditionally populated, if m_collect_flags != 0. May be 0.
Value set only when bit STATE_FLAG_TIMED is set in m_collect_flags.
Note that m_collect_flags & STATE_FLAG_TIMED can be true, while m_pfs_flags & STATE_FLAG_TIMED can be false, so check the proper flag before using this field.
PSI_statement_locker_state::m_cpu_time_start
CPU timing information. Conditionally populated, if m_collect_flags != 0. May be 0.
Value set only when bit STATE_FLAG_CPU is set in m_collect_flags.
Note that m_collect_flags & STATE_FLAG_CPU can be true, while m_pfs_flags & STATE_FLAG_CPU can be false, so check the proper flag before using this field.
PSI_statement_locker_state::m_no_index_used
PSI_statement_locker_state::m_no_good_index_used
PSI_statement_locker_state::m_lock_time
PSI_statement_locker_state::m_rows_sent
PSI_statement_locker_state::m_rows_examined
PSI_statement_locker_state::m_created_tmp_disk_tables
PSI_statement_locker_state::m_created_tmp_tables
PSI_statement_locker_state::m_select_full_join
PSI_statement_locker_state::m_select_full_range_join
PSI_statement_locker_state::m_select_range
PSI_statement_locker_state::m_select_range_check
PSI_statement_locker_state::m_select_scan
PSI_statement_locker_state::m_sort_merge_passes
PSI_statement_locker_state::m_sort_range
PSI_statement_locker_state::m_sort_rows
PSI_statement_locker_state::m_sort_scan
Optimizer metrics associated with a statement. Conditionally populated, if m_collect_flags & STATE_FLAG_BASE.
PSI_statement_locker_state::m_digest
Query digest. Conditionally populated, if m_collect_flags != 0. May be NULL.
Value set only when bit STATE_FLAG_DIGEST is set in m_collect_flags.
PSI_statement_locker_state::m_schema_name
PSI_statement_locker_state::m_schema_name_length
Current schema. Conditionally populated, if m_collect_flags != 0. May be empty.
PSI_statement_locker_state::m_query_sample
PSI_statement_locker_state::m_query_sample_length
PSI_statement_locker_state::m_query_sample_truncated
Query sample. Conditionally populated, if m_collect_flags != 0. May be empty.
PSI_statement_locker_state::m_secondary
Secondary engine. Conditionally populated, if m_collect_flags != 0.
PSI_statement_locker_state::m_parent_prepared_stmt
Parent prepare statement. Conditionally populated, if m_collect_flags != 0. May be NULL.
PSI_statement_locker_state::m_in_prepare
Prepare or Execute the parent prepared statement. Conditionally populated:
If a parent prepared statement exists, indicate if the code prepares (true) or executes (false) the parent statement.
PSI_statement_locker_state::m_statement
Performance schema STATEMENT_CURRENT record. Conditionally populated, if m_collect_flags != 0. May be NULL.
Value set only if pfs_flags & STATE_FLAG_EVENT
void pfs_inc_statement_created_tmp_disk_tables_vc | ( | PSI_statement_locker * | locker, |
ulong | count | ||
) |
void pfs_inc_statement_created_tmp_tables_vc | ( | PSI_statement_locker * | locker, |
ulong | count | ||
) |
void pfs_inc_statement_select_full_join_vc | ( | PSI_statement_locker * | locker, |
ulong | count | ||
) |
void pfs_inc_statement_select_full_range_join_vc | ( | PSI_statement_locker * | locker, |
ulong | count | ||
) |
void pfs_inc_statement_select_range_check_vc | ( | PSI_statement_locker * | locker, |
ulong | count | ||
) |
void pfs_inc_statement_select_range_vc | ( | PSI_statement_locker * | locker, |
ulong | count | ||
) |
void pfs_inc_statement_select_scan_vc | ( | PSI_statement_locker * | locker, |
ulong | count | ||
) |
void pfs_inc_statement_sort_merge_passes_vc | ( | PSI_statement_locker * | locker, |
ulong | count | ||
) |
void pfs_inc_statement_sort_range_vc | ( | PSI_statement_locker * | locker, |
ulong | count | ||
) |
void pfs_inc_statement_sort_rows_vc | ( | PSI_statement_locker * | locker, |
ulong | count | ||
) |
void pfs_inc_statement_sort_scan_vc | ( | PSI_statement_locker * | locker, |
ulong | count | ||
) |
void pfs_notify_statement_query_attributes_vc | ( | PSI_statement_locker * | locker, |
bool | with_query_attributes | ||
) |
PSI_statement_locker * pfs_refine_statement_vc | ( | PSI_statement_locker * | locker, |
PSI_statement_key | key | ||
) |
void pfs_register_statement_vc | ( | const char * | category, |
PSI_statement_info * | info, | ||
int | count | ||
) |
void pfs_reprepare_prepared_stmt_vc | ( | PSI_prepared_stmt * | prepared_stmt | ) |
void pfs_set_prepared_stmt_secondary_engine_vc | ( | PSI_prepared_stmt * | prepared_stmt, |
bool | secondary | ||
) |
void pfs_set_prepared_stmt_text_vc | ( | PSI_prepared_stmt * | prepared_stmt, |
const char * | text, | ||
uint | text_len | ||
) |
void pfs_set_statement_lock_time_vc | ( | PSI_statement_locker * | locker, |
ulonglong | count | ||
) |
void pfs_set_statement_no_good_index_used_vc | ( | PSI_statement_locker * | locker | ) |
void pfs_set_statement_no_index_used_vc | ( | PSI_statement_locker * | locker | ) |
void pfs_set_statement_query_id_vc | ( | PSI_statement_locker * | locker, |
ulonglong | count | ||
) |
void pfs_set_statement_rows_examined_vc | ( | PSI_statement_locker * | locker, |
ulonglong | count | ||
) |
void pfs_set_statement_rows_sent_vc | ( | PSI_statement_locker * | locker, |
ulonglong | count | ||
) |
void pfs_set_statement_secondary_engine_vc | ( | PSI_statement_locker * | locker, |
bool | secondary | ||
) |
void pfs_set_statement_text_vc | ( | PSI_statement_locker * | locker, |
const char * | text, | ||
uint | text_len | ||
) |
void pfs_start_statement_vc | ( | PSI_statement_locker * | locker, |
const char * | db, | ||
uint | db_len, | ||
const char * | src_file, | ||
uint | src_line | ||
) |
void pfs_statement_abort_telemetry_vc | ( | PSI_statement_locker * | locker | ) |