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