MySQL 9.1.0
Source Code Documentation
table_esmh_by_digest.h
Go to the documentation of this file.
1/* Copyright (c) 2016, 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
25#ifndef TABLE_ESMH_BY_DIGEST_H
26#define TABLE_ESMH_BY_DIGEST_H
27
28/**
29 @file storage/perfschema/table_esmh_by_digest.h
30 Table EVENTS_STATEMENTS_HISTOGRAM_BY_DIGEST (declarations).
31*/
32
35
36/**
37 @addtogroup performance_schema_tables
38 @{
39*/
40
41/**
42 Position of a cursor on
43 PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_HISTOGRAM_BY_DIGEST.
44 Index 1 on digest array (0 based).
45 Index 2 on buckets (0 based).
46*/
49
50 inline void reset() {
51 m_index_1 = 0;
52 m_index_2 = 0;
53 }
54
55 inline bool has_more_digest() { return (m_index_1 < digest_max); }
56
57 inline void next_digest() {
58 m_index_1++;
59 m_index_2 = 0;
60 }
61
62 inline bool has_more_buckets() { return (m_index_2 < NUMBER_OF_BUCKETS); }
63
64 inline void next_bucket() { m_index_2++; }
65};
66
68 public:
71 m_key_1("SCHEMA_NAME"),
72 m_key_2("DIGEST"),
73 m_key_3("BUCKET_NUMBER") {}
74
75 ~PFS_index_esmh_by_digest() override = default;
76
78 bool match_bucket(ulong bucket_index);
79
80 private:
84};
85
86/**
87 A row of table
88 PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_HISTOGRAM_BY_DIGEST.
89*/
90
92 /** Column COUNT_BUCKET. */
94 /** Column COUNT_BUCKET_AND_LOWER. */
96};
97
99 /** Columns SCHEMA_NAME, DIGEST. */
101
102 /** Statistics for all buckets. */
104};
105
107 /*
108 No need to repeat SCHEMA_NAME, DIGEST here,
109 only materialize the parts of the row that changes per bucket.
110 */
111 /** Column BUCKET_NUMBER. */
113 /** Column BUCKET_TIMER_LOW. */
115 /** Column BUCKET_TIMER_HIGH. */
117 /** Column COUNT_BUCKET. */
119 /** Column COUNT_BUCKET_AND_LOWER. */
121 /** Column BUCKET_QUANTILE. */
123};
124
125/** Table PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_HISTOGRAM_BY_DIGEST. */
128
129 public:
130 /** Table share */
133 static int delete_all_rows();
134 static ha_rows get_row_count();
135
136 void reset_position() override;
137
138 int rnd_next() override;
139 int rnd_pos(const void *pos) override;
140
141 int index_init(uint idx, bool sorted) override;
142 int index_next() override;
143
144 protected:
145 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
146 bool read_all) override;
147
149
150 public:
151 ~table_esmh_by_digest() override = default;
152
153 protected:
155 int make_row(PFS_statements_digest_stat *stat, ulong bucket_index);
156
157 private:
158 /** Table share lock. */
160 /** Table definition. */
162
163 /** Current row. */
167 /** Current position. */
169 /** Next position. */
171
173};
174
175/** @} */
176#endif
Definition: field.h:577
Definition: pfs_engine_table.h:301
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:70
Definition: table_esmh_by_digest.h:67
PFS_index_esmh_by_digest()
Definition: table_esmh_by_digest.h:69
bool match_bucket(ulong bucket_index)
Definition: table_esmh_by_digest.cc:96
PFS_key_bucket_number m_key_3
Definition: table_esmh_by_digest.h:83
bool match_digest(PFS_statements_digest_stat *pfs)
Definition: table_esmh_by_digest.cc:82
~PFS_index_esmh_by_digest() override=default
PFS_key_digest m_key_2
Definition: table_esmh_by_digest.h:82
PFS_key_schema m_key_1
Definition: table_esmh_by_digest.h:81
Definition: table_helper.h:1559
Definition: table_helper.h:1550
Definition: table_helper.h:1541
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:40
Table PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_HISTOGRAM_BY_DIGEST.
Definition: table_esmh_by_digest.h:126
pos_esmh_by_digest pos_t
Definition: table_esmh_by_digest.h:127
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_esmh_by_digest.cc:264
int index_next() override
Find key in index, read record.
Definition: table_esmh_by_digest.cc:177
PFS_esmh_by_digest_histogram m_materialized_histogram
Definition: table_esmh_by_digest.h:165
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_esmh_by_digest.cc:150
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_esmh_by_digest.cc:126
table_esmh_by_digest()
Definition: table_esmh_by_digest.cc:115
PFS_index_esmh_by_digest * m_opened_index
Definition: table_esmh_by_digest.h:172
void materialize(PFS_statements_digest_stat *stat)
Definition: table_esmh_by_digest.cc:207
static ha_rows get_row_count()
Definition: table_esmh_by_digest.cc:113
PFS_statements_digest_stat * m_materialized_digest
Current row.
Definition: table_esmh_by_digest.h:164
static THR_LOCK m_table_lock
Table share lock.
Definition: table_esmh_by_digest.h:159
static PFS_engine_table_share m_share
Table share.
Definition: table_esmh_by_digest.h:131
~table_esmh_by_digest() override=default
row_esmh_by_digest m_row
Definition: table_esmh_by_digest.h:166
static int delete_all_rows()
Definition: table_esmh_by_digest.cc:108
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_esmh_by_digest.cc:104
pos_t m_pos
Current position.
Definition: table_esmh_by_digest.h:168
int index_init(uint idx, bool sorted) override
Definition: table_esmh_by_digest.cc:169
int make_row(PFS_statements_digest_stat *stat, ulong bucket_index)
Definition: table_esmh_by_digest.cc:232
static Plugin_table m_table_def
Table definition.
Definition: table_esmh_by_digest.h:161
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_esmh_by_digest.cc:121
pos_t m_next_pos
Next position.
Definition: table_esmh_by_digest.h:170
my_off_t ha_rows
Definition: my_base.h:1141
unsigned long long int ulonglong
Definition: my_inttypes.h:56
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: buf0block_hint.cc:30
size_t digest_max
Definition: pfs_digest.cc:54
Statement Digest data structures (declarations).
#define NUMBER_OF_BUCKETS
Number of buckets used in histograms.
Definition: pfs_histogram.h:36
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:66
Row fragment for columns DIGEST, DIGEST_TEXT.
Definition: table_helper.h:566
Position of a double cursor, for iterations using 2 nested loops.
Definition: pfs_engine_table.h:602
uint m_index_1
Outer index.
Definition: pfs_engine_table.h:604
uint m_index_2
Current index within index_1.
Definition: pfs_engine_table.h:606
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:359
A row of table PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_HISTOGRAM_BY_DIGEST.
Definition: table_esmh_by_digest.h:91
ulonglong m_count_bucket
Column COUNT_BUCKET.
Definition: table_esmh_by_digest.h:93
ulonglong m_count_bucket_and_lower
Column COUNT_BUCKET_AND_LOWER.
Definition: table_esmh_by_digest.h:95
Definition: table_esmh_by_digest.h:98
PFS_esmh_by_digest_bucket m_buckets[NUMBER_OF_BUCKETS]
Statistics for all buckets.
Definition: table_esmh_by_digest.h:103
PFS_digest_row m_digest
Columns SCHEMA_NAME, DIGEST.
Definition: table_esmh_by_digest.h:100
A statement digest stat record.
Definition: pfs_digest.h:59
Definition: table.h:1421
Definition: thr_lock.h:139
Position of a cursor on PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_HISTOGRAM_BY_DIGEST.
Definition: table_esmh_by_digest.h:47
pos_esmh_by_digest()
Definition: table_esmh_by_digest.h:48
bool has_more_digest()
Definition: table_esmh_by_digest.h:55
void next_digest()
Definition: table_esmh_by_digest.h:57
void reset()
Definition: table_esmh_by_digest.h:50
bool has_more_buckets()
Definition: table_esmh_by_digest.h:62
void next_bucket()
Definition: table_esmh_by_digest.h:64
Definition: table_esmh_by_digest.h:106
ulonglong m_count_bucket_and_lower
Column COUNT_BUCKET_AND_LOWER.
Definition: table_esmh_by_digest.h:120
ulong m_bucket_number
Column BUCKET_NUMBER.
Definition: table_esmh_by_digest.h:112
ulonglong m_bucket_timer_low
Column BUCKET_TIMER_LOW.
Definition: table_esmh_by_digest.h:114
ulonglong m_bucket_timer_high
Column BUCKET_TIMER_HIGH.
Definition: table_esmh_by_digest.h:116
double m_percentile
Column BUCKET_QUANTILE.
Definition: table_esmh_by_digest.h:122
ulonglong m_count_bucket
Column COUNT_BUCKET.
Definition: table_esmh_by_digest.h:118
Helpers to implement a performance schema table.