MySQL 8.0.29
Source Code Documentation
psi_statement_service.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 2022, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is also distributed with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have included with MySQL.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License, version 2.0, for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef COMPONENTS_SERVICES_PSI_STATEMENT_SERVICE_H
24#define COMPONENTS_SERVICES_PSI_STATEMENT_SERVICE_H
25
28
29/*
30 Version 1.
31 Introduced in MySQL 8.0.3
32 Deprecated in MySQL 8.0.14
33 Status: Deprecated, use version 2 instead.
34 Maintained for binary compatibility of components
35 built against headers from MySQL 8.0.3 -- 8.0.13
36*/
37
38BEGIN_SERVICE_DEFINITION(psi_statement_v1)
39/** @sa register_statement_v1_t. */
40register_statement_v1_t register_statement;
41/** @sa get_thread_statement_locker_v1_t. */
42get_thread_statement_locker_v1_t get_thread_statement_locker;
43/** @sa refine_statement_v1_t. */
44refine_statement_v1_t refine_statement;
45/** @sa start_statement_v1_t. */
46start_statement_v1_t start_statement;
47/** @sa set_statement_text_v1_t. */
48set_statement_text_v1_t set_statement_text;
49/** @sa set_statement_lock_time_t. */
50set_statement_lock_time_t set_statement_lock_time;
51/** @sa set_statement_rows_sent_t. */
52set_statement_rows_sent_t set_statement_rows_sent;
53/** @sa set_statement_rows_examined_t. */
54set_statement_rows_examined_t set_statement_rows_examined;
55/** @sa inc_statement_created_tmp_disk_tables. */
56inc_statement_created_tmp_disk_tables_t inc_statement_created_tmp_disk_tables;
57/** @sa inc_statement_created_tmp_tables. */
58inc_statement_created_tmp_tables_t inc_statement_created_tmp_tables;
59/** @sa inc_statement_select_full_join. */
60inc_statement_select_full_join_t inc_statement_select_full_join;
61/** @sa inc_statement_select_full_range_join. */
62inc_statement_select_full_range_join_t inc_statement_select_full_range_join;
63/** @sa inc_statement_select_range. */
64inc_statement_select_range_t inc_statement_select_range;
65/** @sa inc_statement_select_range_check. */
66inc_statement_select_range_check_t inc_statement_select_range_check;
67/** @sa inc_statement_select_scan. */
68inc_statement_select_scan_t inc_statement_select_scan;
69/** @sa inc_statement_sort_merge_passes. */
70inc_statement_sort_merge_passes_t inc_statement_sort_merge_passes;
71/** @sa inc_statement_sort_range. */
72inc_statement_sort_range_t inc_statement_sort_range;
73/** @sa inc_statement_sort_rows. */
74inc_statement_sort_rows_t inc_statement_sort_rows;
75/** @sa inc_statement_sort_scan. */
76inc_statement_sort_scan_t inc_statement_sort_scan;
77/** @sa set_statement_no_index_used. */
78set_statement_no_index_used_t set_statement_no_index_used;
79/** @sa set_statement_no_good_index_used. */
80set_statement_no_good_index_used_t set_statement_no_good_index_used;
81/** @sa end_statement_v1_t. */
82end_statement_v1_t end_statement;
83
84/** @sa create_prepared_stmt_v1_t. */
86/** @sa destroy_prepared_stmt_v1_t. */
87destroy_prepared_stmt_v1_t destroy_prepared_stmt;
88/** @sa reprepare_prepared_stmt_v1_t. */
89reprepare_prepared_stmt_v1_t reprepare_prepared_stmt;
90/** @sa execute_prepared_stmt_v1_t. */
91execute_prepared_stmt_v1_t execute_prepared_stmt;
92/** @sa set_prepared_stmt_text_v1_t. */
93set_prepared_stmt_text_v1_t set_prepared_stmt_text;
94
95/** @sa digest_start_v1_t. */
96digest_start_v1_t digest_start;
97/** @sa digest_end_v1_t. */
98digest_end_v1_t digest_end;
99
100/** @sa get_sp_share_v1_t. */
101get_sp_share_v1_t get_sp_share;
102/** @sa release_sp_share_v1_t. */
103release_sp_share_v1_t release_sp_share;
104/** @sa start_sp_v1_t. */
106/** @sa start_sp_v1_t. */
108/** @sa drop_sp_v1_t. */
110END_SERVICE_DEFINITION(psi_statement_v1)
111
112/*
113 Version 2.
114 Introduced in MySQL 8.0.14
115 Deprecated in MySQL 8.0.28
116 Status: Deprecated, use version 3 instead.
117 Maintained for binary compatibility of components
118 built against headers from MySQL 8.0.14 -- 8.0.27
119*/
121/** @sa register_statement_v1_t. */
122register_statement_v1_t register_statement;
123/** @sa get_thread_statement_locker_v1_t. */
124get_thread_statement_locker_v1_t get_thread_statement_locker;
125/** @sa refine_statement_v1_t. */
126refine_statement_v1_t refine_statement;
127/** @sa start_statement_v1_t. */
128start_statement_v1_t start_statement;
129/** @sa set_statement_text_v1_t. */
130set_statement_text_v1_t set_statement_text;
131/** @sa set_statement_query_id_t. */
132set_statement_query_id_t set_statement_query_id;
133/** @sa set_statement_lock_time_t. */
134set_statement_lock_time_t set_statement_lock_time;
135/** @sa set_statement_rows_sent_t. */
136set_statement_rows_sent_t set_statement_rows_sent;
137/** @sa set_statement_rows_examined_t. */
138set_statement_rows_examined_t set_statement_rows_examined;
139/** @sa inc_statement_created_tmp_disk_tables. */
140inc_statement_created_tmp_disk_tables_t inc_statement_created_tmp_disk_tables;
141/** @sa inc_statement_created_tmp_tables. */
142inc_statement_created_tmp_tables_t inc_statement_created_tmp_tables;
143/** @sa inc_statement_select_full_join. */
144inc_statement_select_full_join_t inc_statement_select_full_join;
145/** @sa inc_statement_select_full_range_join. */
146inc_statement_select_full_range_join_t inc_statement_select_full_range_join;
147/** @sa inc_statement_select_range. */
148inc_statement_select_range_t inc_statement_select_range;
149/** @sa inc_statement_select_range_check. */
150inc_statement_select_range_check_t inc_statement_select_range_check;
151/** @sa inc_statement_select_scan. */
152inc_statement_select_scan_t inc_statement_select_scan;
153/** @sa inc_statement_sort_merge_passes. */
154inc_statement_sort_merge_passes_t inc_statement_sort_merge_passes;
155/** @sa inc_statement_sort_range. */
156inc_statement_sort_range_t inc_statement_sort_range;
157/** @sa inc_statement_sort_rows. */
158inc_statement_sort_rows_t inc_statement_sort_rows;
159/** @sa inc_statement_sort_scan. */
160inc_statement_sort_scan_t inc_statement_sort_scan;
161/** @sa set_statement_no_index_used. */
162set_statement_no_index_used_t set_statement_no_index_used;
163/** @sa set_statement_no_good_index_used. */
164set_statement_no_good_index_used_t set_statement_no_good_index_used;
165/** @sa end_statement_v1_t. */
166end_statement_v1_t end_statement;
167
168/** @sa create_prepared_stmt_v1_t. */
170/** @sa destroy_prepared_stmt_v1_t. */
171destroy_prepared_stmt_v1_t destroy_prepared_stmt;
172/** @sa reprepare_prepared_stmt_v1_t. */
173reprepare_prepared_stmt_v1_t reprepare_prepared_stmt;
174/** @sa execute_prepared_stmt_v1_t. */
175execute_prepared_stmt_v1_t execute_prepared_stmt;
176/** @sa set_prepared_stmt_text_v1_t. */
177set_prepared_stmt_text_v1_t set_prepared_stmt_text;
178
179/** @sa digest_start_v1_t. */
180digest_start_v1_t digest_start;
181/** @sa digest_end_v1_t. */
183
184/** @sa get_sp_share_v1_t. */
185get_sp_share_v1_t get_sp_share;
186/** @sa release_sp_share_v1_t. */
187release_sp_share_v1_t release_sp_share;
188/** @sa start_sp_v1_t. */
190/** @sa start_sp_v1_t. */
192/** @sa drop_sp_v1_t. */
194END_SERVICE_DEFINITION(psi_statement_v2)
195
196/*
197 Version 3.
198 Introduced in MySQL 8.0.28
199 Status: active
200 Changes compared to version 2:
201 - added set_statement_secondary_engine
202 - added set_prepared_stmt_secondary_engine
203*/
205/** @sa register_statement_v1_t. */
206register_statement_v1_t register_statement;
207/** @sa get_thread_statement_locker_v1_t. */
208get_thread_statement_locker_v1_t get_thread_statement_locker;
209/** @sa refine_statement_v1_t. */
210refine_statement_v1_t refine_statement;
211/** @sa start_statement_v1_t. */
212start_statement_v1_t start_statement;
213/** @sa set_statement_text_v1_t. */
214set_statement_text_v1_t set_statement_text;
215/** @sa set_statement_query_id_t. */
216set_statement_query_id_t set_statement_query_id;
217/** @sa set_statement_lock_time_t. */
218set_statement_lock_time_t set_statement_lock_time;
219/** @sa set_statement_rows_sent_t. */
220set_statement_rows_sent_t set_statement_rows_sent;
221/** @sa set_statement_rows_examined_t. */
222set_statement_rows_examined_t set_statement_rows_examined;
223/** @sa inc_statement_created_tmp_disk_tables. */
224inc_statement_created_tmp_disk_tables_t inc_statement_created_tmp_disk_tables;
225/** @sa inc_statement_created_tmp_tables. */
226inc_statement_created_tmp_tables_t inc_statement_created_tmp_tables;
227/** @sa inc_statement_select_full_join. */
228inc_statement_select_full_join_t inc_statement_select_full_join;
229/** @sa inc_statement_select_full_range_join. */
230inc_statement_select_full_range_join_t inc_statement_select_full_range_join;
231/** @sa inc_statement_select_range. */
232inc_statement_select_range_t inc_statement_select_range;
233/** @sa inc_statement_select_range_check. */
234inc_statement_select_range_check_t inc_statement_select_range_check;
235/** @sa inc_statement_select_scan. */
236inc_statement_select_scan_t inc_statement_select_scan;
237/** @sa inc_statement_sort_merge_passes. */
238inc_statement_sort_merge_passes_t inc_statement_sort_merge_passes;
239/** @sa inc_statement_sort_range. */
240inc_statement_sort_range_t inc_statement_sort_range;
241/** @sa inc_statement_sort_rows. */
242inc_statement_sort_rows_t inc_statement_sort_rows;
243/** @sa inc_statement_sort_scan. */
244inc_statement_sort_scan_t inc_statement_sort_scan;
245/** @sa set_statement_no_index_used. */
246set_statement_no_index_used_t set_statement_no_index_used;
247/** @sa set_statement_no_good_index_used. */
248set_statement_no_good_index_used_t set_statement_no_good_index_used;
249/** @sa set_statement_secondary_engine_v3_t. */
250set_statement_secondary_engine_v3_t set_statement_secondary_engine;
251/** @sa end_statement_v1_t. */
252end_statement_v1_t end_statement;
253
254/** @sa create_prepared_stmt_v1_t. */
256/** @sa destroy_prepared_stmt_v1_t. */
257destroy_prepared_stmt_v1_t destroy_prepared_stmt;
258/** @sa reprepare_prepared_stmt_v1_t. */
259reprepare_prepared_stmt_v1_t reprepare_prepared_stmt;
260/** @sa execute_prepared_stmt_v1_t. */
261execute_prepared_stmt_v1_t execute_prepared_stmt;
262/** @sa set_prepared_stmt_text_v1_t. */
263set_prepared_stmt_text_v1_t set_prepared_stmt_text;
264/** @sa set_prepared_stmt_secondary_engine_v3_t */
265set_prepared_stmt_secondary_engine_v3_t set_prepared_stmt_secondary_engine;
266
267/** @sa digest_start_v1_t. */
268digest_start_v1_t digest_start;
269/** @sa digest_end_v1_t. */
271
272/** @sa get_sp_share_v1_t. */
273get_sp_share_v1_t get_sp_share;
274/** @sa release_sp_share_v1_t. */
275release_sp_share_v1_t release_sp_share;
276/** @sa start_sp_v1_t. */
278/** @sa start_sp_v1_t. */
280/** @sa drop_sp_v1_t. */
282END_SERVICE_DEFINITION(psi_statement_v3)
283
284#endif /* COMPONENTS_SERVICES_PSI_STATEMENT_SERVICE_H */
void(* destroy_prepared_stmt_v1_t)(PSI_prepared_stmt *prepared_stmt)
destroy a prepare statement.
Definition: psi_statement_bits.h:456
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:379
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:395
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:347
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:281
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:363
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:494
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:371
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:487
void(* register_statement_v1_t)(const char *category, struct PSI_statement_info_v1 *info, int count)
Statement registration API.
Definition: psi_statement_bits.h:234
void(* reprepare_prepared_stmt_v1_t)(PSI_prepared_stmt *prepared_stmt)
reprepare a prepare statement.
Definition: psi_statement_bits.h:462
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:403
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:469
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:410
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:514
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:387
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:268
void(* release_sp_share_v1_t)(struct PSI_sp_share *share)
Release a stored program share.
Definition: psi_statement_bits.h:523
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:291
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.
Definition: psi_statement_bits.h:246
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:425
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:530
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:315
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:417
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:502
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:355
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.
Definition: psi_statement_bits.h:478
void(* end_sp_v1_t)(struct PSI_sp_locker *locker)
Definition: psi_statement_bits.h:528
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:339
void(* end_statement_v1_t)(struct PSI_statement_locker *locker, void *stmt_da)
End a statement event.
Definition: psi_statement_bits.h:434
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:299
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:307
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:257
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:447
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:525
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:323
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:331
PFS_prepared_stmt * create_prepared_stmt(void *identity, PFS_thread *thread, PFS_program *pfs_program, PFS_events_statements *pfs_stmt, uint stmt_id, const char *stmt_name, uint stmt_name_length, const char *sqltext, uint sqltext_length)
Definition: pfs_prepared_stmt.cc:72
Performance schema instrumentation interface.
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:90
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:85