MySQL 8.3.0
Source Code Documentation
psi_statement.h
Go to the documentation of this file.
1/* Copyright (c) 2008, 2023, 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 also distributed 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 included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef MYSQL_PSI_STATEMENT_H
24#define MYSQL_PSI_STATEMENT_H
25
26/**
27 @file include/mysql/psi/psi_statement.h
28 Performance schema instrumentation interface.
29
30 @defgroup psi_abi_statement Statement Instrumentation (ABI)
31 @ingroup psi_abi
32 @{
33*/
34
35#include "my_inttypes.h"
36#include "my_macros.h"
37
38/* HAVE_PSI_*_INTERFACE */
39#include "my_psi_config.h" // IWYU pragma: keep
40
41#include "my_sharedlib.h"
43
44/** Entry point for the performance schema interface. */
46 /**
47 ABI interface finder.
48 Calling this method with an interface version number returns either
49 an instance of the ABI for this version, or NULL.
50 @sa PSI_STATEMENT_VERSION_1
51 @sa PSI_STATEMENT_VERSION_2
52 @sa PSI_STATEMENT_VERSION_3
53 @sa PSI_STATEMENT_VERSION_4
54 @sa PSI_CURRENT_STATEMENT_VERSION
55 */
56 void *(*get_interface)(int version);
57};
59
60#ifdef HAVE_PSI_STATEMENT_INTERFACE
61
62/**
63 Performance Schema Statement Interface, version 1.
64 @since PSI_STATEMENT_VERSION_1
65*/
67 /* No binary compatibility with old PLUGIN */
69};
70
71/**
72 Performance Schema Statement Interface, version 2.
73 @since PSI_STATEMENT_VERSION_2
74*/
76 /* No binary compatibility with old PLUGIN */
78};
79
80/**
81 Performance Schema Statement Interface, version 3.
82 @since PSI_STATEMENT_VERSION_3
83*/
85 /* No binary compatibility with old PLUGIN */
87};
88
89/**
90 Performance Schema Statement Interface, version 4.
91 @since PSI_STATEMENT_VERSION_4
92*/
94 /* No binary compatibility with old PLUGIN */
96};
97
98/**
99 Performance Schema Statement Interface, version 5.
100 @since PSI_STATEMENT_VERSION_5
101*/
103 /** @sa register_statement_v1_t. */
105 /** @sa get_thread_statement_locker_v5_t. */
107 /** @sa refine_statement_v1_t. */
109 /** @sa start_statement_v1_t. */
111 /** @sa set_statement_text_v1_t. */
113 /** @sa set_statement_query_id. */
115 /** @sa set_statement_lock_time_t. */
117 /** @sa set_statement_rows_sent_t. */
119 /** @sa set_statement_rows_examined_t. */
121 /** @sa inc_statement_created_tmp_disk_tables. */
123 /** @sa inc_statement_created_tmp_tables. */
125 /** @sa inc_statement_select_full_join. */
127 /** @sa inc_statement_select_full_range_join. */
129 /** @sa inc_statement_select_range. */
131 /** @sa inc_statement_select_range_check. */
133 /** @sa inc_statement_select_scan. */
135 /** @sa inc_statement_sort_merge_passes. */
137 /** @sa inc_statement_sort_range. */
139 /** @sa inc_statement_sort_rows. */
141 /** @sa inc_statement_sort_scan. */
143 /** @sa set_statement_no_index_used. */
145 /** @sa set_statement_no_good_index_used. */
147 /** @sa set_statement_secondary_engine_v3_t. */
149 /** @sa end_statement_v1_t. */
151
152 /** @sa create_prepared_stmt_v1_t. */
154 /** @sa destroy_prepared_stmt_v1_t. */
156 /** @sa reprepare_prepared_stmt_v1_t. */
158 /** @sa execute_prepared_stmt_v1_t. */
160 /** @sa set_prepared_stmt_text_v1_t. */
162 /** @sa set_prepared_stmt_secondary_engine_v3_t */
164
165 /** @sa digest_start_v1_t. */
167 /** @sa digest_end_v1_t. */
169
170 /** @sa get_sp_share_v1_t. */
172 /** @sa release_sp_share_v1_t. */
174 /** @sa start_sp_v1_t. */
176 /** @sa start_sp_v1_t. */
178 /** @sa drop_sp_v1_t. */
180
183};
184
186
188
189#endif /* HAVE_PSI_STATEMENT_INTERFACE */
190
191/** @} (end of group psi_abi_statement) */
192
193#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:496
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:419
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:435
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:387
MYSQL_PLUGIN_IMPORT PSI_statement_service_t * psi_statement_service
Definition: psi_noop.cc:835
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:321
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:403
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:534
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:411
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:527
void(* register_statement_v1_t)(const char *category, struct PSI_statement_info_v1 *info, int count)
Statement registration API.
Definition: psi_statement_bits.h:274
void(* reprepare_prepared_stmt_v1_t)(PSI_prepared_stmt *prepared_stmt)
reprepare a prepare statement.
Definition: psi_statement_bits.h:502
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:286
void(* statement_abort_telemetry_v5_t)(PSI_statement_locker *locker)
Definition: psi_statement_bits.h:582
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:443
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:509
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:450
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:554
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:427
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:308
void(* release_sp_share_v1_t)(struct PSI_sp_share *share)
Release a stored program share.
Definition: psi_statement_bits.h:563
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:331
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:465
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:570
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:355
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:457
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:542
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:395
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:518
void(* end_sp_v1_t)(struct PSI_sp_locker *locker)
Definition: psi_statement_bits.h:568
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:379
void(* end_statement_v1_t)(struct PSI_statement_locker *locker, void *stmt_da)
End a statement event.
Definition: psi_statement_bits.h:474
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:339
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:347
void(* notify_statement_query_attributes_v5_t)(struct PSI_statement_locker *locker, bool with_query_attributes)
Definition: psi_statement_bits.h:579
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:297
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:487
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:565
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:363
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:371
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:70
Performance schema instrumentation interface.
required uint64 version
Definition: replication_group_member_actions.proto:40
Entry point for the performance schema interface.
Definition: psi_statement.h:45
Performance Schema Statement Interface, version 1.
Definition: psi_statement.h:66
void * this_interface_is_obsolete
Definition: psi_statement.h:68
Performance Schema Statement Interface, version 2.
Definition: psi_statement.h:75
void * this_interface_is_obsolete
Definition: psi_statement.h:77
Performance Schema Statement Interface, version 3.
Definition: psi_statement.h:84
void * this_interface_is_obsolete
Definition: psi_statement.h:86
Performance Schema Statement Interface, version 4.
Definition: psi_statement.h:93
void * this_interface_is_obsolete
Definition: psi_statement.h:95
Performance Schema Statement Interface, version 5.
Definition: psi_statement.h:102
inc_statement_select_scan_t inc_statement_select_scan
Definition: psi_statement.h:134
set_statement_rows_sent_t set_statement_rows_sent
Definition: psi_statement.h:118
get_thread_statement_locker_v5_t get_thread_statement_locker
Definition: psi_statement.h:106
inc_statement_created_tmp_tables_t inc_statement_created_tmp_tables
Definition: psi_statement.h:124
set_statement_secondary_engine_v3_t set_statement_secondary_engine
Definition: psi_statement.h:148
reprepare_prepared_stmt_v1_t reprepare_prepared_stmt
Definition: psi_statement.h:157
set_statement_lock_time_t set_statement_lock_time
Definition: psi_statement.h:116
execute_prepared_stmt_v1_t execute_prepared_stmt
Definition: psi_statement.h:159
set_statement_no_index_used_t set_statement_no_index_used
Definition: psi_statement.h:144
digest_start_v1_t digest_start
Definition: psi_statement.h:166
destroy_prepared_stmt_v1_t destroy_prepared_stmt
Definition: psi_statement.h:155
release_sp_share_v1_t release_sp_share
Definition: psi_statement.h:173
set_prepared_stmt_secondary_engine_v3_t set_prepared_stmt_secondary_engine
Definition: psi_statement.h:163
set_statement_rows_examined_t set_statement_rows_examined
Definition: psi_statement.h:120
register_statement_v1_t register_statement
Definition: psi_statement.h:104
statement_abort_telemetry_v5_t statement_abort_telemetry
Definition: psi_statement.h:182
set_statement_query_id_t set_statement_query_id
Definition: psi_statement.h:114
start_statement_v1_t start_statement
Definition: psi_statement.h:110
set_prepared_stmt_text_v1_t set_prepared_stmt_text
Definition: psi_statement.h:161
end_sp_v1_t end_sp
Definition: psi_statement.h:177
inc_statement_sort_merge_passes_t inc_statement_sort_merge_passes
Definition: psi_statement.h:136
set_statement_no_good_index_used_t set_statement_no_good_index_used
Definition: psi_statement.h:146
digest_end_v1_t digest_end
Definition: psi_statement.h:168
inc_statement_select_full_range_join_t inc_statement_select_full_range_join
Definition: psi_statement.h:128
notify_statement_query_attributes_v5_t notify_statement_query_attributes
Definition: psi_statement.h:181
inc_statement_sort_scan_t inc_statement_sort_scan
Definition: psi_statement.h:142
inc_statement_sort_range_t inc_statement_sort_range
Definition: psi_statement.h:138
inc_statement_select_full_join_t inc_statement_select_full_join
Definition: psi_statement.h:126
create_prepared_stmt_v1_t create_prepared_stmt
Definition: psi_statement.h:153
get_sp_share_v1_t get_sp_share
Definition: psi_statement.h:171
inc_statement_created_tmp_disk_tables_t inc_statement_created_tmp_disk_tables
Definition: psi_statement.h:122
end_statement_v1_t end_statement
Definition: psi_statement.h:150
refine_statement_v1_t refine_statement
Definition: psi_statement.h:108
drop_sp_v1_t drop_sp
Definition: psi_statement.h:179
start_sp_v1_t start_sp
Definition: psi_statement.h:175
inc_statement_sort_rows_t inc_statement_sort_rows
Definition: psi_statement.h:140
set_statement_text_v1_t set_statement_text
Definition: psi_statement.h:112
inc_statement_select_range_t inc_statement_select_range
Definition: psi_statement.h:130
inc_statement_select_range_check_t inc_statement_select_range_check
Definition: psi_statement.h:132