MySQL  8.0.16
Source Code Documentation

Classes

struct  PSI_statement_info_v1
 Statement instrument information. More...
 
struct  PSI_statement_locker_state_v1
 State data storage for get_thread_statement_locker_v1_t, get_thread_statement_locker_v1_t. More...
 
struct  PSI_sp_locker_state_v1
 
struct  PSI_statement_bootstrap
 Entry point for the performance schema interface. More...
 
struct  PSI_statement_service_v1
 Performance Schema Statement Interface, version 1. More...
 
struct  PSI_statement_service_v2
 Performance Schema Statement Interface, version 2. More...
 

Macros

#define PSI_STATEMENT_VERSION_1   1
 Performance Schema Statement Interface number for version 1. More...
 
#define PSI_STATEMENT_VERSION_2   2
 Performance Schema Statement Interface number for version 2. More...
 
#define PSI_CURRENT_STATEMENT_VERSION   2
 Performance Schema Statement Interface number for the most recent version. More...
 
#define PSI_SCHEMA_NAME_LEN   (64 * 3)
 

Typedefs

typedef unsigned int PSI_statement_key
 Instrumented statement key. More...
 
typedef struct PSI_statement_locker PSI_statement_locker
 
typedef struct PSI_prepared_stmt PSI_prepared_stmt
 
typedef struct PSI_digest_locker PSI_digest_locker
 
typedef struct PSI_sp_share PSI_sp_share
 
typedef struct PSI_sp_locker PSI_sp_locker
 
typedef struct PSI_statement_info_v1 PSI_statement_info_v1
 
typedef struct PSI_statement_locker_state_v1 PSI_statement_locker_state_v1
 
typedef struct PSI_sp_locker_state_v1 PSI_sp_locker_state_v1
 
typedef void(* register_statement_v1_t) (const char *category, struct PSI_statement_info_v1 *info, int count)
 Statement registration API. More...
 
typedef struct PSI_statement_locker *(* get_thread_statement_locker_v1_t) (struct PSI_statement_locker_state_v1 *state, PSI_statement_key key, const void *charset, PSI_sp_share *sp_share)
 Get a statement instrumentation locker. More...
 
typedef struct PSI_statement_locker *(* refine_statement_v1_t) (struct PSI_statement_locker *locker, PSI_statement_key key)
 Refine a statement locker to a more specific key. More...
 
typedef void(* start_statement_v1_t) (struct PSI_statement_locker *locker, const char *db, unsigned int db_length, const char *src_file, unsigned int src_line)
 Start a new statement event. More...
 
typedef void(* set_statement_text_v1_t) (struct PSI_statement_locker *locker, const char *text, unsigned int text_len)
 Set the statement text for a statement event. More...
 
typedef void(* set_statement_query_id_t) (struct PSI_statement_locker *locker, unsigned long long query_id)
 Set a statement query id. More...
 
typedef void(* set_statement_lock_time_t) (struct PSI_statement_locker *locker, unsigned long long lock_time)
 Set a statement event lock time. More...
 
typedef void(* set_statement_rows_sent_t) (struct PSI_statement_locker *locker, unsigned long long count)
 Set a statement event rows sent metric. More...
 
typedef void(* set_statement_rows_examined_t) (struct PSI_statement_locker *locker, unsigned long long count)
 Set a statement event rows examined metric. More...
 
typedef void(* inc_statement_created_tmp_disk_tables_t) (struct PSI_statement_locker *locker, unsigned long count)
 Increment a statement event "created tmp disk tables" metric. More...
 
typedef void(* inc_statement_created_tmp_tables_t) (struct PSI_statement_locker *locker, unsigned long count)
 Increment a statement event "created tmp tables" metric. More...
 
typedef void(* inc_statement_select_full_join_t) (struct PSI_statement_locker *locker, unsigned long count)
 Increment a statement event "select full join" metric. More...
 
typedef void(* inc_statement_select_full_range_join_t) (struct PSI_statement_locker *locker, unsigned long count)
 Increment a statement event "select full range join" metric. More...
 
typedef void(* inc_statement_select_range_t) (struct PSI_statement_locker *locker, unsigned long count)
 Increment a statement event "select range join" metric. More...
 
typedef void(* inc_statement_select_range_check_t) (struct PSI_statement_locker *locker, unsigned long count)
 Increment a statement event "select range check" metric. More...
 
typedef void(* inc_statement_select_scan_t) (struct PSI_statement_locker *locker, unsigned long count)
 Increment a statement event "select scan" metric. More...
 
typedef void(* inc_statement_sort_merge_passes_t) (struct PSI_statement_locker *locker, unsigned long count)
 Increment a statement event "sort merge passes" metric. More...
 
typedef void(* inc_statement_sort_range_t) (struct PSI_statement_locker *locker, unsigned long count)
 Increment a statement event "sort range" metric. More...
 
typedef void(* inc_statement_sort_rows_t) (struct PSI_statement_locker *locker, unsigned long count)
 Increment a statement event "sort rows" metric. More...
 
typedef void(* inc_statement_sort_scan_t) (struct PSI_statement_locker *locker, unsigned long count)
 Increment a statement event "sort scan" metric. More...
 
typedef void(* set_statement_no_index_used_t) (struct PSI_statement_locker *locker)
 Set a statement event "no index used" metric. More...
 
typedef void(* set_statement_no_good_index_used_t) (struct PSI_statement_locker *locker)
 Set a statement event "no good index used" metric. More...
 
typedef void(* end_statement_v1_t) (struct PSI_statement_locker *locker, void *stmt_da)
 End a statement event. More...
 
typedef PSI_prepared_stmt *(* create_prepared_stmt_v1_t) (void *identity, unsigned int stmt_id, PSI_statement_locker *locker, const char *stmt_name, size_t stmt_name_length, const char *name, size_t length)
 Get a prepare statement. More...
 
typedef void(* destroy_prepared_stmt_v1_t) (PSI_prepared_stmt *prepared_stmt)
 destroy a prepare statement. More...
 
typedef void(* reprepare_prepared_stmt_v1_t) (PSI_prepared_stmt *prepared_stmt)
 repreare a prepare statement. More...
 
typedef void(* execute_prepared_stmt_v1_t) (PSI_statement_locker *locker, PSI_prepared_stmt *prepared_stmt)
 Record a prepare statement instrumentation execute event. More...
 
typedef void(* set_prepared_stmt_text_v1_t) (PSI_prepared_stmt *prepared_stmt, const char *text, unsigned int text_len)
 Set the statement text for a prepared statment event. More...
 
typedef struct PSI_digest_locker *(* digest_start_v1_t) (struct PSI_statement_locker *locker)
 Get a digest locker for the current statement. More...
 
typedef void(* digest_end_v1_t) (struct PSI_digest_locker *locker, const struct sql_digest_storage *digest)
 Add a computed digest to the current digest instrumentation. More...
 
typedef struct PSI_sp_share *(* get_sp_share_v1_t) (unsigned int object_type, const char *schema_name, unsigned int schema_name_length, const char *object_name, unsigned int object_name_length)
 Acquire a sp share instrumentation. More...
 
typedef void(* release_sp_share_v1_t) (struct PSI_sp_share *share)
 Release a stored program share. More...
 
typedef PSI_sp_locker *(* start_sp_v1_t) (struct PSI_sp_locker_state_v1 *state, struct PSI_sp_share *sp_share)
 
typedef void(* end_sp_v1_t) (struct PSI_sp_locker *locker)
 
typedef void(* drop_sp_v1_t) (unsigned int object_type, const char *schema_name, unsigned int schema_name_length, const char *object_name, unsigned int object_name_length)
 
typedef struct PSI_statement_info_v1 PSI_statement_info
 
typedef struct PSI_statement_locker_state_v1 PSI_statement_locker_state
 
typedef struct PSI_sp_locker_state_v1 PSI_sp_locker_state
 
typedef struct PSI_statement_bootstrap PSI_statement_bootstrap
 
typedef struct PSI_statement_service_v2 PSI_statement_service_t
 

Variables

MYSQL_PLUGIN_IMPORT PSI_statement_service_tpsi_statement_service
 

Detailed Description

Macro Definition Documentation

◆ PSI_CURRENT_STATEMENT_VERSION

#define PSI_CURRENT_STATEMENT_VERSION   2

Performance Schema Statement Interface number for the most recent version.

The most current version is PSI_STATEMENT_VERSION_2

◆ PSI_SCHEMA_NAME_LEN

#define PSI_SCHEMA_NAME_LEN   (64 * 3)

◆ PSI_STATEMENT_VERSION_1

#define PSI_STATEMENT_VERSION_1   1

Performance Schema Statement Interface number for version 1.

This version is deprecated.

◆ PSI_STATEMENT_VERSION_2

#define PSI_STATEMENT_VERSION_2   2

Performance Schema Statement Interface number for version 2.

This version is supported.

Typedef Documentation

◆ create_prepared_stmt_v1_t

typedef PSI_prepared_stmt*(* create_prepared_stmt_v1_t) (void *identity, unsigned int stmt_id, PSI_statement_locker *locker, const char *stmt_name, size_t stmt_name_length, const char *name, size_t length)

Get a prepare statement.

Parameters
lockera statement locker for the running thread.

◆ destroy_prepared_stmt_v1_t

typedef void(* destroy_prepared_stmt_v1_t) (PSI_prepared_stmt *prepared_stmt)

destroy a prepare statement.

Parameters
prepared_stmtprepared statement.

◆ digest_end_v1_t

typedef void(* digest_end_v1_t) (struct PSI_digest_locker *locker, const struct sql_digest_storage *digest)

Add a computed digest to the current digest instrumentation.

Parameters
lockera digest locker for the current statement
digestthe computed digest

◆ digest_start_v1_t

typedef struct PSI_digest_locker*(* digest_start_v1_t) (struct PSI_statement_locker *locker)

Get a digest locker for the current statement.

Parameters
lockera statement locker for the running thread

◆ drop_sp_v1_t

typedef void(* drop_sp_v1_t) (unsigned int object_type, const char *schema_name, unsigned int schema_name_length, const char *object_name, unsigned int object_name_length)

◆ end_sp_v1_t

typedef void(* end_sp_v1_t) (struct PSI_sp_locker *locker)

◆ end_statement_v1_t

typedef void(* end_statement_v1_t) (struct PSI_statement_locker *locker, void *stmt_da)

End a statement event.

Parameters
lockerthe statement locker
stmt_dathe statement diagnostics area.
See also
Diagnostics_area

◆ execute_prepared_stmt_v1_t

typedef void(* execute_prepared_stmt_v1_t) (PSI_statement_locker *locker, PSI_prepared_stmt *prepared_stmt)

Record a prepare statement instrumentation execute event.

Parameters
lockera statement locker for the running thread.
prepared_stmtprepared statement.

◆ get_sp_share_v1_t

typedef struct PSI_sp_share*(* get_sp_share_v1_t) (unsigned int object_type, const char *schema_name, unsigned int schema_name_length, const char *object_name, unsigned int object_name_length)

Acquire a sp share instrumentation.

Parameters
object_typetype of stored program
schema_nameschema name of stored program
schema_name_lengthlength of schema_name
object_nameobject name of stored program
object_name_lengthlength of object_name
Returns
a stored program share instrumentation, or NULL

◆ get_thread_statement_locker_v1_t

typedef struct PSI_statement_locker*(* get_thread_statement_locker_v1_t) (struct PSI_statement_locker_state_v1 *state, PSI_statement_key key, const void *charset, PSI_sp_share *sp_share)

Get a statement instrumentation locker.

Parameters
statedata storage for the locker
keythe statement instrumentation key
charsetclient character set
Returns
a statement locker, or NULL

◆ inc_statement_created_tmp_disk_tables_t

typedef void(* inc_statement_created_tmp_disk_tables_t) (struct PSI_statement_locker *locker, unsigned long count)

Increment a statement event "created tmp disk tables" metric.

Parameters
lockerthe statement locker
countthe metric increment value

◆ inc_statement_created_tmp_tables_t

typedef void(* inc_statement_created_tmp_tables_t) (struct PSI_statement_locker *locker, unsigned long count)

Increment a statement event "created tmp tables" metric.

Parameters
lockerthe statement locker
countthe metric increment value

◆ inc_statement_select_full_join_t

typedef void(* inc_statement_select_full_join_t) (struct PSI_statement_locker *locker, unsigned long count)

Increment a statement event "select full join" metric.

Parameters
lockerthe statement locker
countthe metric increment value

◆ inc_statement_select_full_range_join_t

typedef void(* inc_statement_select_full_range_join_t) (struct PSI_statement_locker *locker, unsigned long count)

Increment a statement event "select full range join" metric.

Parameters
lockerthe statement locker
countthe metric increment value

◆ inc_statement_select_range_check_t

typedef void(* inc_statement_select_range_check_t) (struct PSI_statement_locker *locker, unsigned long count)

Increment a statement event "select range check" metric.

Parameters
lockerthe statement locker
countthe metric increment value

◆ inc_statement_select_range_t

typedef void(* inc_statement_select_range_t) (struct PSI_statement_locker *locker, unsigned long count)

Increment a statement event "select range join" metric.

Parameters
lockerthe statement locker
countthe metric increment value

◆ inc_statement_select_scan_t

typedef void(* inc_statement_select_scan_t) (struct PSI_statement_locker *locker, unsigned long count)

Increment a statement event "select scan" metric.

Parameters
lockerthe statement locker
countthe metric increment value

◆ inc_statement_sort_merge_passes_t

typedef void(* inc_statement_sort_merge_passes_t) (struct PSI_statement_locker *locker, unsigned long count)

Increment a statement event "sort merge passes" metric.

Parameters
lockerthe statement locker
countthe metric increment value

◆ inc_statement_sort_range_t

typedef void(* inc_statement_sort_range_t) (struct PSI_statement_locker *locker, unsigned long count)

Increment a statement event "sort range" metric.

Parameters
lockerthe statement locker
countthe metric increment value

◆ inc_statement_sort_rows_t

typedef void(* inc_statement_sort_rows_t) (struct PSI_statement_locker *locker, unsigned long count)

Increment a statement event "sort rows" metric.

Parameters
lockerthe statement locker
countthe metric increment value

◆ inc_statement_sort_scan_t

typedef void(* inc_statement_sort_scan_t) (struct PSI_statement_locker *locker, unsigned long count)

Increment a statement event "sort scan" metric.

Parameters
lockerthe statement locker
countthe metric increment value

◆ PSI_digest_locker

◆ PSI_prepared_stmt

◆ PSI_sp_locker

typedef struct PSI_sp_locker PSI_sp_locker

◆ PSI_sp_locker_state

◆ PSI_sp_locker_state_v1

◆ PSI_sp_share

typedef struct PSI_sp_share PSI_sp_share

◆ PSI_statement_bootstrap

◆ PSI_statement_info

◆ PSI_statement_info_v1

◆ PSI_statement_key

typedef unsigned int PSI_statement_key

Instrumented statement key.

To instrument a statement, a statement key must be obtained using register_statement. Using a zero key always disable the instrumentation.

◆ PSI_statement_locker

◆ PSI_statement_locker_state

◆ PSI_statement_locker_state_v1

◆ PSI_statement_service_t

◆ refine_statement_v1_t

typedef struct PSI_statement_locker*(* refine_statement_v1_t) (struct PSI_statement_locker *locker, PSI_statement_key key)

Refine a statement locker to a more specific key.

Note that only events declared mutable can be refined.

Parameters
lockerthe statement locker for the current event
keythe new key for the event
See also
PSI_FLAG_MUTABLE

◆ register_statement_v1_t

typedef void(* register_statement_v1_t) (const char *category, struct PSI_statement_info_v1 *info, int count)

Statement registration API.

Parameters
categorya category name
infoan array of statement info to register
countthe size of the info array

◆ release_sp_share_v1_t

typedef void(* release_sp_share_v1_t) (struct PSI_sp_share *share)

Release a stored program share.

Parameters
sharethe stored program share to release

◆ reprepare_prepared_stmt_v1_t

typedef void(* reprepare_prepared_stmt_v1_t) (PSI_prepared_stmt *prepared_stmt)

repreare a prepare statement.

Parameters
prepared_stmtprepared statement.

◆ set_prepared_stmt_text_v1_t

typedef void(* set_prepared_stmt_text_v1_t) (PSI_prepared_stmt *prepared_stmt, const char *text, unsigned int text_len)

Set the statement text for a prepared statment event.

Parameters
prepared_stmtprepared statement.
textthe prepared statement text
text_lenthe prepared statement text length

◆ set_statement_lock_time_t

typedef void(* set_statement_lock_time_t) (struct PSI_statement_locker *locker, unsigned long long lock_time)

Set a statement event lock time.

Parameters
lockerthe statement locker
lock_timethe locked time, in microseconds

◆ set_statement_no_good_index_used_t

typedef void(* set_statement_no_good_index_used_t) (struct PSI_statement_locker *locker)

Set a statement event "no good index used" metric.

Parameters
lockerthe statement locker

◆ set_statement_no_index_used_t

typedef void(* set_statement_no_index_used_t) (struct PSI_statement_locker *locker)

Set a statement event "no index used" metric.

Parameters
lockerthe statement locker

◆ set_statement_query_id_t

typedef void(* set_statement_query_id_t) (struct PSI_statement_locker *locker, unsigned long long query_id)

Set a statement query id.

Introduced in MySQL 8.0.14

Parameters
lockerthe statement locker
query_idthe query id

◆ set_statement_rows_examined_t

typedef void(* set_statement_rows_examined_t) (struct PSI_statement_locker *locker, unsigned long long count)

Set a statement event rows examined metric.

Parameters
lockerthe statement locker
countthe number of rows examined

◆ set_statement_rows_sent_t

typedef void(* set_statement_rows_sent_t) (struct PSI_statement_locker *locker, unsigned long long count)

Set a statement event rows sent metric.

Parameters
lockerthe statement locker
countthe number of rows sent

◆ set_statement_text_v1_t

typedef void(* set_statement_text_v1_t) (struct PSI_statement_locker *locker, const char *text, unsigned int text_len)

Set the statement text for a statement event.

Note that the statement text pointer must remain valid until end statement is called.

Parameters
lockerthe current statement locker
textthe statement text
text_lenthe statement text length

◆ start_sp_v1_t

typedef PSI_sp_locker*(* start_sp_v1_t) (struct PSI_sp_locker_state_v1 *state, struct PSI_sp_share *sp_share)

◆ start_statement_v1_t

typedef void(* start_statement_v1_t) (struct PSI_statement_locker *locker, const char *db, unsigned int db_length, const char *src_file, unsigned int src_line)

Start a new statement event.

Parameters
lockerthe statement locker for this event
dbthe active database name for this statement
db_lengththe active database name length for this statement
src_filesource file name
src_linesource line number

Variable Documentation

◆ psi_statement_service