MySQL 8.4.2
Source Code Documentation
psi_statement.h
Go to the documentation of this file.
1/* Copyright (c) 2008, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef MYSQL_PSI_STATEMENT_H
25#define MYSQL_PSI_STATEMENT_H
26
27/**
28 @file include/mysql/psi/psi_statement.h
29 Performance schema instrumentation interface.
30
31 @defgroup psi_abi_statement Statement Instrumentation (ABI)
32 @ingroup psi_abi
33 @{
34*/
35
36#include "my_inttypes.h"
37#include "my_macros.h"
38
39/* HAVE_PSI_*_INTERFACE */
40#include "my_psi_config.h" // IWYU pragma: keep
41
42#include "my_sharedlib.h"
44
45/** Entry point for the performance schema interface. */
47 /**
48 ABI interface finder.
49 Calling this method with an interface version number returns either
50 an instance of the ABI for this version, or NULL.
51 @sa PSI_STATEMENT_VERSION_1
52 @sa PSI_STATEMENT_VERSION_2
53 @sa PSI_STATEMENT_VERSION_3
54 @sa PSI_STATEMENT_VERSION_4
55 @sa PSI_CURRENT_STATEMENT_VERSION
56 */
57 void *(*get_interface)(int version);
58};
60
61#ifdef HAVE_PSI_STATEMENT_INTERFACE
62
63/**
64 Performance Schema Statement Interface, version 1.
65 @since PSI_STATEMENT_VERSION_1
66*/
68 /* No binary compatibility with old PLUGIN */
70};
71
72/**
73 Performance Schema Statement Interface, version 2.
74 @since PSI_STATEMENT_VERSION_2
75*/
77 /* No binary compatibility with old PLUGIN */
79};
80
81/**
82 Performance Schema Statement Interface, version 3.
83 @since PSI_STATEMENT_VERSION_3
84*/
86 /* No binary compatibility with old PLUGIN */
88};
89
90/**
91 Performance Schema Statement Interface, version 4.
92 @since PSI_STATEMENT_VERSION_4
93*/
95 /* No binary compatibility with old PLUGIN */
97};
98
99/**
100 Performance Schema Statement Interface, version 5.
101 @since PSI_STATEMENT_VERSION_5
102*/
104 /** @sa register_statement_v1_t. */
106 /** @sa get_thread_statement_locker_v5_t. */
108 /** @sa refine_statement_v1_t. */
110 /** @sa start_statement_v1_t. */
112 /** @sa set_statement_text_v1_t. */
114 /** @sa set_statement_query_id. */
116 /** @sa set_statement_lock_time_t. */
118 /** @sa set_statement_rows_sent_t. */
120 /** @sa set_statement_rows_examined_t. */
122 /** @sa inc_statement_created_tmp_disk_tables. */
124 /** @sa inc_statement_created_tmp_tables. */
126 /** @sa inc_statement_select_full_join. */
128 /** @sa inc_statement_select_full_range_join. */
130 /** @sa inc_statement_select_range. */
132 /** @sa inc_statement_select_range_check. */
134 /** @sa inc_statement_select_scan. */
136 /** @sa inc_statement_sort_merge_passes. */
138 /** @sa inc_statement_sort_range. */
140 /** @sa inc_statement_sort_rows. */
142 /** @sa inc_statement_sort_scan. */
144 /** @sa set_statement_no_index_used. */
146 /** @sa set_statement_no_good_index_used. */
148 /** @sa set_statement_secondary_engine_v3_t. */
150 /** @sa end_statement_v1_t. */
152
153 /** @sa create_prepared_stmt_v1_t. */
155 /** @sa destroy_prepared_stmt_v1_t. */
157 /** @sa reprepare_prepared_stmt_v1_t. */
159 /** @sa execute_prepared_stmt_v1_t. */
161 /** @sa set_prepared_stmt_text_v1_t. */
163 /** @sa set_prepared_stmt_secondary_engine_v3_t */
165
166 /** @sa digest_start_v1_t. */
168 /** @sa digest_end_v1_t. */
170
171 /** @sa get_sp_share_v1_t. */
173 /** @sa release_sp_share_v1_t. */
175 /** @sa start_sp_v1_t. */
177 /** @sa start_sp_v1_t. */
179 /** @sa drop_sp_v1_t. */
181
184};
185
187
189
190#endif /* HAVE_PSI_STATEMENT_INTERFACE */
191
192/** @} (end of group psi_abi_statement) */
193
194#endif /* MYSQL_PSI_STATEMENT_H */
void(* destroy_prepared_stmt_v1_t)(PSI_prepared_stmt *prepared_stmt)
destroy a prepare statement.
Definition: psi_statement_bits.h:497
void(* inc_statement_sort_merge_passes_t)(struct PSI_statement_locker *locker, unsigned long count)
Increment a statement event "sort merge passes" metric.
Definition: psi_statement_bits.h:420
void(* inc_statement_sort_rows_t)(struct PSI_statement_locker *locker, unsigned long count)
Increment a statement event "sort rows" metric.
Definition: psi_statement_bits.h:436
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.
Definition: psi_statement_bits.h:388
MYSQL_PLUGIN_IMPORT PSI_statement_service_t * psi_statement_service
Definition: psi_noop.cc:836
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.
Definition: psi_statement_bits.h:322
void(* inc_statement_select_range_check_t)(struct PSI_statement_locker *locker, unsigned long count)
Increment a statement event "select range check" metric.
Definition: psi_statement_bits.h:404
struct PSI_digest_locker *(* digest_start_v1_t)(struct PSI_statement_locker *locker)
Get a digest locker for the current statement.
Definition: psi_statement_bits.h:535
void(* inc_statement_select_scan_t)(struct PSI_statement_locker *locker, unsigned long count)
Increment a statement event "select scan" metric.
Definition: psi_statement_bits.h:412
void(* set_prepared_stmt_secondary_engine_v3_t)(PSI_prepared_stmt *prepared_stmt, bool secondary)
Set a prepared statement EXECUTION_ENGINE attribute.
Definition: psi_statement_bits.h:528
void(* register_statement_v1_t)(const char *category, struct PSI_statement_info_v1 *info, int count)
Statement registration API.
Definition: psi_statement_bits.h:275
void(* reprepare_prepared_stmt_v1_t)(PSI_prepared_stmt *prepared_stmt)
reprepare a prepare statement.
Definition: psi_statement_bits.h:503
struct PSI_statement_locker *(* get_thread_statement_locker_v5_t)(struct PSI_statement_locker_state_v5 *state, PSI_statement_key key, const void *charset, PSI_sp_share *sp_share)
Get a statement instrumentation locker.
Definition: psi_statement_bits.h:287
void(* statement_abort_telemetry_v5_t)(PSI_statement_locker *locker)
Definition: psi_statement_bits.h:583
void(* inc_statement_sort_scan_t)(struct PSI_statement_locker *locker, unsigned long count)
Increment a statement event "sort scan" metric.
Definition: psi_statement_bits.h:444
void(* execute_prepared_stmt_v1_t)(PSI_statement_locker *locker, PSI_prepared_stmt *prepared_stmt)
Record a prepare statement instrumentation execute event.
Definition: psi_statement_bits.h:510
void(* set_statement_no_index_used_t)(struct PSI_statement_locker *locker)
Set a statement event "no index used" metric.
Definition: psi_statement_bits.h:451
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.
Definition: psi_statement_bits.h:555
void(* inc_statement_sort_range_t)(struct PSI_statement_locker *locker, unsigned long count)
Increment a statement event "sort range" metric.
Definition: psi_statement_bits.h:428
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.
Definition: psi_statement_bits.h:309
void(* release_sp_share_v1_t)(struct PSI_sp_share *share)
Release a stored program share.
Definition: psi_statement_bits.h:564
void(* set_statement_query_id_t)(struct PSI_statement_locker *locker, unsigned long long query_id)
Set a statement query id.
Definition: psi_statement_bits.h:332
void(* set_statement_secondary_engine_v3_t)(struct PSI_statement_locker *locker, bool secondary)
Set a statement EXECUTION_ENGINE attribute.
Definition: psi_statement_bits.h:466
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)
Definition: psi_statement_bits.h:571
void(* set_statement_rows_examined_t)(struct PSI_statement_locker *locker, unsigned long long count)
Set a statement event rows examined metric.
Definition: psi_statement_bits.h:356
void(* set_statement_no_good_index_used_t)(struct PSI_statement_locker *locker)
Set a statement event "no good index used" metric.
Definition: psi_statement_bits.h:458
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.
Definition: psi_statement_bits.h:543
void(* inc_statement_select_range_t)(struct PSI_statement_locker *locker, unsigned long count)
Increment a statement event "select range join" metric.
Definition: psi_statement_bits.h:396
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 statement event.
Definition: psi_statement_bits.h:519
void(* end_sp_v1_t)(struct PSI_sp_locker *locker)
Definition: psi_statement_bits.h:569
void(* inc_statement_select_full_join_t)(struct PSI_statement_locker *locker, unsigned long count)
Increment a statement event "select full join" metric.
Definition: psi_statement_bits.h:380
void(* end_statement_v1_t)(struct PSI_statement_locker *locker, void *stmt_da)
End a statement event.
Definition: psi_statement_bits.h:475
void(* set_statement_lock_time_t)(struct PSI_statement_locker *locker, unsigned long long lock_time)
Set a statement event lock time.
Definition: psi_statement_bits.h:340
void(* set_statement_rows_sent_t)(struct PSI_statement_locker *locker, unsigned long long count)
Set a statement event rows sent metric.
Definition: psi_statement_bits.h:348
void(* notify_statement_query_attributes_v5_t)(struct PSI_statement_locker *locker, bool with_query_attributes)
Definition: psi_statement_bits.h:580
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.
Definition: psi_statement_bits.h:298
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 *sql_text, size_t sql_text_length)
Get a prepare statement.
Definition: psi_statement_bits.h:488
PSI_sp_locker *(* start_sp_v1_t)(struct PSI_sp_locker_state_v1 *state, struct PSI_sp_share *sp_share)
Definition: psi_statement_bits.h:566
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.
Definition: psi_statement_bits.h:364
void(* inc_statement_created_tmp_tables_t)(struct PSI_statement_locker *locker, unsigned long count)
Increment a statement event "created tmp tables" metric.
Definition: psi_statement_bits.h:372
Some integer typedefs for easier portability.
Some common macros.
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
Functions related to handling of plugins and other dynamically loaded libraries.
#define MYSQL_PLUGIN_IMPORT
Definition: my_sharedlib.h:71
Performance schema instrumentation interface.
required uint64 version
Definition: replication_group_member_actions.proto:41
Entry point for the performance schema interface.
Definition: psi_statement.h:46
Performance Schema Statement Interface, version 1.
Definition: psi_statement.h:67
void * this_interface_is_obsolete
Definition: psi_statement.h:69
Performance Schema Statement Interface, version 2.
Definition: psi_statement.h:76
void * this_interface_is_obsolete
Definition: psi_statement.h:78
Performance Schema Statement Interface, version 3.
Definition: psi_statement.h:85
void * this_interface_is_obsolete
Definition: psi_statement.h:87
Performance Schema Statement Interface, version 4.
Definition: psi_statement.h:94
void * this_interface_is_obsolete
Definition: psi_statement.h:96
Performance Schema Statement Interface, version 5.
Definition: psi_statement.h:103
inc_statement_select_scan_t inc_statement_select_scan
Definition: psi_statement.h:135
set_statement_rows_sent_t set_statement_rows_sent
Definition: psi_statement.h:119
get_thread_statement_locker_v5_t get_thread_statement_locker
Definition: psi_statement.h:107
inc_statement_created_tmp_tables_t inc_statement_created_tmp_tables
Definition: psi_statement.h:125
set_statement_secondary_engine_v3_t set_statement_secondary_engine
Definition: psi_statement.h:149
reprepare_prepared_stmt_v1_t reprepare_prepared_stmt
Definition: psi_statement.h:158
set_statement_lock_time_t set_statement_lock_time
Definition: psi_statement.h:117
execute_prepared_stmt_v1_t execute_prepared_stmt
Definition: psi_statement.h:160
set_statement_no_index_used_t set_statement_no_index_used
Definition: psi_statement.h:145
digest_start_v1_t digest_start
Definition: psi_statement.h:167
destroy_prepared_stmt_v1_t destroy_prepared_stmt
Definition: psi_statement.h:156
release_sp_share_v1_t release_sp_share
Definition: psi_statement.h:174
set_prepared_stmt_secondary_engine_v3_t set_prepared_stmt_secondary_engine
Definition: psi_statement.h:164
set_statement_rows_examined_t set_statement_rows_examined
Definition: psi_statement.h:121
register_statement_v1_t register_statement
Definition: psi_statement.h:105
statement_abort_telemetry_v5_t statement_abort_telemetry
Definition: psi_statement.h:183
set_statement_query_id_t set_statement_query_id
Definition: psi_statement.h:115
start_statement_v1_t start_statement
Definition: psi_statement.h:111
set_prepared_stmt_text_v1_t set_prepared_stmt_text
Definition: psi_statement.h:162
end_sp_v1_t end_sp
Definition: psi_statement.h:178
inc_statement_sort_merge_passes_t inc_statement_sort_merge_passes
Definition: psi_statement.h:137
set_statement_no_good_index_used_t set_statement_no_good_index_used
Definition: psi_statement.h:147
digest_end_v1_t digest_end
Definition: psi_statement.h:169
inc_statement_select_full_range_join_t inc_statement_select_full_range_join
Definition: psi_statement.h:129
notify_statement_query_attributes_v5_t notify_statement_query_attributes
Definition: psi_statement.h:182
inc_statement_sort_scan_t inc_statement_sort_scan
Definition: psi_statement.h:143
inc_statement_sort_range_t inc_statement_sort_range
Definition: psi_statement.h:139
inc_statement_select_full_join_t inc_statement_select_full_join
Definition: psi_statement.h:127
create_prepared_stmt_v1_t create_prepared_stmt
Definition: psi_statement.h:154
get_sp_share_v1_t get_sp_share
Definition: psi_statement.h:172
inc_statement_created_tmp_disk_tables_t inc_statement_created_tmp_disk_tables
Definition: psi_statement.h:123
end_statement_v1_t end_statement
Definition: psi_statement.h:151
refine_statement_v1_t refine_statement
Definition: psi_statement.h:109
drop_sp_v1_t drop_sp
Definition: psi_statement.h:180
start_sp_v1_t start_sp
Definition: psi_statement.h:176
inc_statement_sort_rows_t inc_statement_sort_rows
Definition: psi_statement.h:141
set_statement_text_v1_t set_statement_text
Definition: psi_statement.h:113
inc_statement_select_range_t inc_statement_select_range
Definition: psi_statement.h:131
inc_statement_select_range_check_t inc_statement_select_range_check
Definition: psi_statement.h:133