MySQL 8.0.39
Source Code Documentation
pfs_events_statements.h
Go to the documentation of this file.
1/* Copyright (c) 2010, 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 PFS_EVENTS_STATEMENTS_H
25#define PFS_EVENTS_STATEMENTS_H
26
27/**
28 @file storage/perfschema/pfs_events_statements.h
29 Events statements data structures (declarations).
30*/
31
32#include <sys/types.h>
33#include <atomic>
34
35#include "my_inttypes.h"
40
41struct PFS_thread;
42struct PFS_account;
43struct PFS_user;
44struct PFS_host;
45
46/** A statement record. */
48 /*
49 MAINTAINER:
50 See pointer arithmetic in copy_events_statements(),
51 attribute here are copied in block.
52 */
53
54 /** STATEMENT_ID, from the SQL layer QUERY_ID. */
56
60
61 /** Database name. */
63
64 /** Locked time. */
66
67 /** Diagnostics area, error number. */
69 /** Diagnostics area, @c SQLSTATE. */
71 /** Diagnostics area, error count. */
73 /** Diagnostics area, warning count. */
75 /** Diagnostics area, rows affected. */
77
78 /** Optimizer metric, number of rows sent. */
80 /** Optimizer metric, number of rows examined. */
82 /** Optimizer metric, number of temporary tables created on disk. */
84 /** Optimizer metric, number of temporary tables created. */
86 /** Optimizer metric, number of full join. */
88 /** Optimizer metric, number of full range join. */
90 /** Optimizer metric, number of select range. */
92 /** Optimizer metric, number of select range checks. */
94 /** Optimizer metric, number of select scans. */
96 /** Optimizer metric, number of sort merge passes. */
98 /** Optimizer metric, number of sort ranges. */
100 /** Optimizer metric, number of sort rows. */
102 /** Optimizer metric, number of sort scans. */
104 /** Optimizer metric, number of 'no index used'. */
106 /** Optimizer metric, number of 'no good index used'. */
108
109 /**
110 CPU time.
111 Expressed in STORAGE units (nanoseconds).
112 */
114
117
118 /** True if @c SQL_TEXT was truncated. */
120 /** Statement character set number. */
122
123 /** Executed on the secondary engine. */
125
126 /*
127 MAINTAINER:
128 See pointer arithmetic in copy_events_statements(),
129 attribute here are copied when needed.
130 */
131
132 /**
133 SQL_TEXT.
134 This pointer is immutable,
135 and always point to pre allocated memory.
136 */
138 /** Length of @c m_sqltext. */
140 /**
141 Statement digest.
142 This underlying token array storage pointer is immutable,
143 and always point to pre allocated memory.
144 */
146
147 /**
148 Length of @c m_message_text.
149 This is placed __before__ m_message_text[], for data locality.
150 */
152 /** Diagnostics area, message text. */
154};
155
159
160extern ulong nested_statement_lost;
161
166
171
173 size_t events_statements_history_long_sizing);
175
187
188#endif
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
#define MYSQL_ERRMSG_SIZE
Max length of a error message.
Definition: mysql_com.h:880
#define SQLSTATE_LENGTH
Definition: mysql_com.h:75
char * user
Definition: mysqladmin.cc:60
const char * host
Definition: mysqladmin.cc:59
Data types for columns used in the performance schema tables (declarations)
enum_object_type
Enum values for the various OBJECT_TYPE columns.
Definition: pfs_column_types.h:222
Statement Digest data structures (declarations).
Events data structures (declarations).
ulong nested_statement_lost
Definition: pfs_instr.cc:50
void reset_events_statements_by_account()
Reset table EVENTS_STATEMENTS_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME data.
Definition: pfs_events_statements.cc:303
void reset_events_statements_by_user()
Reset table EVENTS_STATEMENTS_SUMMARY_BY_USER_BY_EVENT_NAME data.
Definition: pfs_events_statements.cc:312
void cleanup_events_statements_history_long()
Cleanup table EVENTS_STATEMENTS_HISTORY_LONG.
Definition: pfs_events_statements.cc:135
void insert_events_statements_history(PFS_thread *thread, PFS_events_statements *statement)
Insert a statement record in table EVENTS_STATEMENTS_HISTORY.
Definition: pfs_events_statements.cc:191
PFS_events_statements * events_statements_history_long_array
EVENTS_STATEMENTS_HISTORY_LONG circular buffer.
Definition: pfs_events_statements.cc:63
void reset_events_statements_by_thread()
Reset table EVENTS_STATEMENTS_SUMMARY_BY_THREAD_BY_EVENT_NAME data.
Definition: pfs_events_statements.cc:292
void reset_events_statements_current()
Reset table EVENTS_STATEMENTS_CURRENT data.
Definition: pfs_events_statements.cc:252
bool flag_events_statements_history_long
Consumer flag for table EVENTS_STATEMENTS_HISTORY_LONG.
Definition: pfs_events_statements.cc:56
void aggregate_account_statements(PFS_account *account)
PFS_cacheline_atomic_uint32 events_statements_history_long_index
Index in EVENTS_STATEMENTS_HISTORY_LONG circular buffer.
Definition: pfs_events_statements.cc:61
bool flag_events_statements_current
Consumer flag for table EVENTS_STATEMENTS_CURRENT.
Definition: pfs_events_statements.cc:52
bool events_statements_history_long_full
True if EVENTS_STATEMENTS_HISTORY_LONG circular buffer is full.
Definition: pfs_events_statements.cc:59
int init_events_statements_history_long(size_t events_statements_history_long_sizing)
Initialize table EVENTS_STATEMENTS_HISTORY_LONG.
Definition: pfs_events_statements.cc:72
void insert_events_statements_history_long(PFS_events_statements *statement)
Insert a statement record in table EVENTS_STATEMENTS_HISTORY_LONG.
Definition: pfs_events_statements.cc:223
size_t events_statements_history_long_size
Definition: pfs_events_statements.cc:48
void aggregate_host_statements(PFS_host *host)
bool flag_events_statements_history
Consumer flag for table EVENTS_STATEMENTS_HISTORY.
Definition: pfs_events_statements.cc:54
void reset_events_statements_history()
Reset table EVENTS_STATEMENTS_HISTORY data.
Definition: pfs_events_statements.cc:268
void reset_events_statements_by_host()
Reset table EVENTS_STATEMENTS_SUMMARY_BY_HOST_BY_EVENT_NAME data.
Definition: pfs_events_statements.cc:321
void aggregate_user_statements(PFS_user *user)
void reset_events_statements_history_long()
Reset table EVENTS_STATEMENTS_HISTORY_LONG data.
Definition: pfs_events_statements.cc:273
bool flag_events_statements_cpu
Consumer flag for CPU_TIME columns.
Definition: pfs_events_statements.cc:50
void reset_events_statements_global()
Reset table EVENTS_STATEMENTS_GLOBAL_BY_EVENT_NAME data.
Definition: pfs_events_statements.cc:326
Object names (declarations).
Per account statistics.
Definition: pfs_account.h:67
An atomic uint32 variable, guaranteed to be alone in a CPU cache line.
Definition: pfs_global.h:77
A statement record.
Definition: pfs_events_statements.h:47
uint m_sql_errno
Diagnostics area, error number.
Definition: pfs_events_statements.h:68
ulonglong m_select_scan
Optimizer metric, number of select scans.
Definition: pfs_events_statements.h:95
ulonglong m_created_tmp_tables
Optimizer metric, number of temporary tables created.
Definition: pfs_events_statements.h:85
uint m_warning_count
Diagnostics area, warning count.
Definition: pfs_events_statements.h:74
ulonglong m_sort_rows
Optimizer metric, number of sort rows.
Definition: pfs_events_statements.h:101
sql_digest_storage m_digest_storage
Statement digest.
Definition: pfs_events_statements.h:145
ulonglong m_lock_time
Locked time.
Definition: pfs_events_statements.h:65
char * m_sqltext
SQL_TEXT.
Definition: pfs_events_statements.h:137
enum_object_type m_sp_type
Definition: pfs_events_statements.h:57
ulonglong m_statement_id
STATEMENT_ID, from the SQL layer QUERY_ID.
Definition: pfs_events_statements.h:55
ulonglong m_select_full_join
Optimizer metric, number of full join.
Definition: pfs_events_statements.h:87
ulonglong m_no_good_index_used
Optimizer metric, number of 'no good index used'.
Definition: pfs_events_statements.h:107
ulonglong m_rows_affected
Diagnostics area, rows affected.
Definition: pfs_events_statements.h:76
PFS_schema_name m_current_schema_name
Database name.
Definition: pfs_events_statements.h:62
char m_sqlstate[SQLSTATE_LENGTH]
Diagnostics area, SQLSTATE.
Definition: pfs_events_statements.h:70
ulonglong m_select_full_range_join
Optimizer metric, number of full range join.
Definition: pfs_events_statements.h:89
ulonglong m_rows_sent
Optimizer metric, number of rows sent.
Definition: pfs_events_statements.h:79
bool m_sqltext_truncated
True if SQL_TEXT was truncated.
Definition: pfs_events_statements.h:119
char m_message_text[MYSQL_ERRMSG_SIZE+1]
Diagnostics area, message text.
Definition: pfs_events_statements.h:153
ulonglong m_select_range
Optimizer metric, number of select range.
Definition: pfs_events_statements.h:91
ulonglong m_sort_range
Optimizer metric, number of sort ranges.
Definition: pfs_events_statements.h:99
uint m_sqltext_cs_number
Statement character set number.
Definition: pfs_events_statements.h:121
ulonglong m_max_controlled_memory
Definition: pfs_events_statements.h:115
ulonglong m_sort_merge_passes
Optimizer metric, number of sort merge passes.
Definition: pfs_events_statements.h:97
uint m_sqltext_length
Length of m_sqltext.
Definition: pfs_events_statements.h:139
ulonglong m_max_total_memory
Definition: pfs_events_statements.h:116
ulonglong m_select_range_check
Optimizer metric, number of select range checks.
Definition: pfs_events_statements.h:93
uint m_message_text_length
Length of m_message_text.
Definition: pfs_events_statements.h:151
ulonglong m_rows_examined
Optimizer metric, number of rows examined.
Definition: pfs_events_statements.h:81
ulonglong m_created_tmp_disk_tables
Optimizer metric, number of temporary tables created on disk.
Definition: pfs_events_statements.h:83
PFS_schema_name m_schema_name
Definition: pfs_events_statements.h:58
uint m_error_count
Diagnostics area, error count.
Definition: pfs_events_statements.h:72
ulonglong m_cpu_time
CPU time.
Definition: pfs_events_statements.h:113
ulonglong m_no_index_used
Optimizer metric, number of 'no index used'.
Definition: pfs_events_statements.h:105
bool m_secondary
Executed on the secondary engine.
Definition: pfs_events_statements.h:124
ulonglong m_sort_scan
Optimizer metric, number of sort scans.
Definition: pfs_events_statements.h:103
PFS_object_name m_object_name
Definition: pfs_events_statements.h:59
An event record.
Definition: pfs_events.h:38
Per host statistics.
Definition: pfs_host.h:64
Definition: pfs_name.h:336
Definition: pfs_name.h:186
Instrumented thread implementation.
Definition: pfs_instr.h:373
Per user statistics.
Definition: pfs_user.h:63
Structure to store token count/array for a statement on which digest is to be calculated.
Definition: sql_digest.h:98
Definition: mysqlslap.cc:217
unsigned int uint
Definition: uca9-dump.cc:75