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