MySQL 8.3.0
Source Code Documentation
table_os_global_by_type.h
Go to the documentation of this file.
1/* Copyright (c) 2010, 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_OBJECTS_SUMMARY_GLOBAL_BY_TYPE_H
25#define TABLE_OBJECTS_SUMMARY_GLOBAL_BY_TYPE_H
26
27/**
28 @file storage/perfschema/table_os_global_by_type.h
29 Table OBJECTS_SUMMARY_GLOBAL_BY_TYPE (declarations).
30*/
31
32#include <sys/types.h>
33
34#include "my_base.h"
37
38class Field;
39class Plugin_table;
40struct PFS_program;
41struct PFS_table_share;
42struct TABLE;
43struct THR_LOCK;
44
45/**
46 @addtogroup performance_schema_tables
47 @{
48*/
49
50/**
51 A row of table
52 PERFORMANCE_SCHEMA.OBJECTS_SUMMARY_GLOBAL_BY_TYPE.
53*/
55 /** Column OBJECT_TYPE, SCHEMA_NAME, OBJECT_NAME. */
57
58 /** Columns COUNT_STAR, SUM/MIN/AVG/MAX TIMER_WAIT. */
60};
61
62/**
63 Position of a cursor on
64 PERFORMANCE_SCHEMA.OBJECTS_SUMMARY_GLOBAL_BY_TYPE.
65 Index 1 on object type
66 Index 2 on object instance (0 based)
67*/
71
72 inline void reset() {
74 m_index_2 = 0;
75 }
76
77 inline bool has_more_view() { return (m_index_1 <= LAST_VIEW); }
78
79 inline void next_view() {
80 m_index_1++;
81 m_index_2 = 0;
82 }
83};
84
86 public:
89 m_key_1("OBJECT_TYPE"),
90 m_key_2("OBJECT_SCHEMA"),
91 m_key_3("OBJECT_NAME") {}
92
93 ~PFS_index_os_global_by_type() override = default;
94
95 virtual bool match(PFS_table_share *pfs);
96 virtual bool match(PFS_program *pfs);
97
98 private:
102};
103
104/** Table PERFORMANCE_SCHEMA.OBJECTS_SUMMARY_GLOBAL_BY_TYPE. */
106 public:
107 /** Table share */
110 static int delete_all_rows();
111 static ha_rows get_row_count();
112
113 void reset_position() override;
114
115 int rnd_next() override;
116 int rnd_pos(const void *pos) override;
117
118 int index_init(uint idx, bool sorted) override;
119 int index_next() override;
120
121 protected:
122 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
123 bool read_all) override;
125
126 public:
127 ~table_os_global_by_type() override = default;
128
129 protected:
130 int make_table_row(PFS_table_share *table_share);
131 int make_program_row(PFS_program *pfs_program);
132
133 private:
134 /** Table share lock. */
136 /** Table definition. */
138
139 /** Current row. */
141 /** Current position. */
143 /** Next position. */
145
146 protected:
148};
149
150/** @} */
151#endif
Definition: field.h:574
Definition: pfs_engine_table.h:299
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:69
Definition: table_os_global_by_type.h:85
PFS_key_object_type m_key_1
Definition: table_os_global_by_type.h:99
PFS_key_object_schema m_key_2
Definition: table_os_global_by_type.h:100
virtual bool match(PFS_table_share *pfs)
Definition: table_os_global_by_type.cc:82
~PFS_index_os_global_by_type() override=default
PFS_key_object_name m_key_3
Definition: table_os_global_by_type.h:101
PFS_index_os_global_by_type()
Definition: table_os_global_by_type.h:87
Definition: table_helper.h:1655
Definition: table_helper.h:1640
Definition: table_helper.h:1680
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:39
Table PERFORMANCE_SCHEMA.OBJECTS_SUMMARY_GLOBAL_BY_TYPE.
Definition: table_os_global_by_type.h:105
static THR_LOCK m_table_lock
Table share lock.
Definition: table_os_global_by_type.h:135
int index_next() override
Find key in index, read record.
Definition: table_os_global_by_type.cc:227
table_os_global_by_type()
Definition: table_os_global_by_type.cc:141
static PFS_engine_table_share m_share
Table share.
Definition: table_os_global_by_type.h:108
pos_os_global_by_type m_pos
Current position.
Definition: table_os_global_by_type.h:142
row_os_global_by_type m_row
Current row.
Definition: table_os_global_by_type.h:140
static Plugin_table m_table_def
Table definition.
Definition: table_os_global_by_type.h:137
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_os_global_by_type.cc:126
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_os_global_by_type.cc:326
static int delete_all_rows()
Definition: table_os_global_by_type.cc:130
~table_os_global_by_type() override=default
static ha_rows get_row_count()
Definition: table_os_global_by_type.cc:136
pos_os_global_by_type m_next_pos
Next position.
Definition: table_os_global_by_type.h:144
int index_init(uint idx, bool sorted) override
Definition: table_os_global_by_type.cc:218
PFS_index_os_global_by_type * m_opened_index
Definition: table_os_global_by_type.h:147
int make_program_row(PFS_program *pfs_program)
Definition: table_os_global_by_type.cc:270
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_os_global_by_type.cc:152
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_os_global_by_type.cc:191
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_os_global_by_type.cc:147
int make_table_row(PFS_table_share *table_share)
Definition: table_os_global_by_type.cc:286
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1140
static PFS_engine_table_share_proxy table
Definition: pfs.cc:60
Definition: buf0block_hint.cc:29
Performance schema tables (declarations).
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:65
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
Row fragment for columns OBJECT_TYPE, SCHEMA_NAME, OBJECT_NAME.
Definition: table_helper.h:602
Name space, internal views used within object summaries.
Definition: table_helper.h:519
static const uint LAST_VIEW
Definition: table_helper.h:523
static const uint FIRST_VIEW
Definition: table_helper.h:520
Definition: pfs_program.h:56
Row fragment for single statistics columns (COUNT, SUM, MIN, AVG, MAX)
Definition: table_helper.h:688
Instrumentation metadata for a table share.
Definition: pfs_instr_class.h:457
Definition: table.h:1403
Definition: thr_lock.h:138
Position of a cursor on PERFORMANCE_SCHEMA.OBJECTS_SUMMARY_GLOBAL_BY_TYPE.
Definition: table_os_global_by_type.h:69
void reset()
Definition: table_os_global_by_type.h:72
bool has_more_view()
Definition: table_os_global_by_type.h:77
pos_os_global_by_type()
Definition: table_os_global_by_type.h:70
void next_view()
Definition: table_os_global_by_type.h:79
A row of table PERFORMANCE_SCHEMA.OBJECTS_SUMMARY_GLOBAL_BY_TYPE.
Definition: table_os_global_by_type.h:54
PFS_object_row m_object
Column OBJECT_TYPE, SCHEMA_NAME, OBJECT_NAME.
Definition: table_os_global_by_type.h:56
PFS_stat_row m_stat
Columns COUNT_STAR, SUM/MIN/AVG/MAX TIMER_WAIT.
Definition: table_os_global_by_type.h:59
Helpers to implement a performance schema table.