· 6 years ago · Apr 12, 2019, 07:14 PM
1-- Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
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 as published by
5-- the Free Software Foundation; version 2 of the License.
6--
7-- This program is distributed in the hope that it will be useful,
8-- but WITHOUT ANY WARRANTY; without even the implied warranty of
9-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10-- GNU General Public License for more details.
11--
12-- You should have received a copy of the GNU General Public License
13-- along with this program; if not, write to the Free Software
14-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15
16--
17-- The system tables of MySQL Server
18--
19
20set sql_mode='';
21set default_storage_engine=myisam;
22
23CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
24
25-- Remember for later if db table already existed
26set @had_db_table= @@warning_count != 0;
27
28CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tablespace_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) unsigned DEFAULT 0 NOT NULL, plugin char(64) DEFAULT 'mysql_native_password' NOT NULL, authentication_string TEXT, password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, password_last_changed timestamp NULL DEFAULT NULL, password_lifetime smallint unsigned NULL DEFAULT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
29
30-- Remember for later if user table already existed
31set @had_user_table= @@warning_count != 0;
32
33
34CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
35
36
37CREATE TABLE IF NOT EXISTS plugin ( name varchar(64) DEFAULT '' NOT NULL, dl varchar(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci comment='MySQL plugins';
38
39
40CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table';
41
42
43CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
44
45CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
46
47
48CREATE TABLE IF NOT EXISTS help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url text not null, primary key (help_topic_id), unique index (name) ) engine=INNODB STATS_PERSISTENT=0 CHARACTER SET utf8 comment='help topics';
49
50
51CREATE TABLE IF NOT EXISTS help_category ( help_category_id smallint unsigned not null, name char(64) not null, parent_category_id smallint unsigned null, url text not null, primary key (help_category_id), unique index (name) ) engine=INNODB STATS_PERSISTENT=0 CHARACTER SET utf8 comment='help categories';
52
53
54CREATE TABLE IF NOT EXISTS help_relation ( help_topic_id int unsigned not null, help_keyword_id int unsigned not null, primary key (help_keyword_id, help_topic_id) ) engine=INNODB STATS_PERSISTENT=0 CHARACTER SET utf8 comment='keyword-topic relation';
55
56
57CREATE TABLE IF NOT EXISTS help_keyword ( help_keyword_id int unsigned not null, name char(64) not null, primary key (help_keyword_id), unique index (name) ) engine=INNODB STATS_PERSISTENT=0 CHARACTER SET utf8 comment='help keywords';
58
59
60CREATE TABLE IF NOT EXISTS time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) ) engine=INNODB STATS_PERSISTENT=0 CHARACTER SET utf8 comment='Time zone names';
61
62
63CREATE TABLE IF NOT EXISTS time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) engine=INNODB STATS_PERSISTENT=0 CHARACTER SET utf8 comment='Time zones';
64
65
66CREATE TABLE IF NOT EXISTS time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=INNODB STATS_PERSISTENT=0 CHARACTER SET utf8 comment='Time zone transitions';
67
68
69CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=INNODB STATS_PERSISTENT=0 CHARACTER SET utf8 comment='Time zone transition types';
70
71
72CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=INNODB STATS_PERSISTENT=0 CHARACTER SET utf8 comment='Leap seconds information for time zones';
73
74
75CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment text collate utf8_bin NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures';
76
77CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) COLLATE utf8_general_ci DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
78
79-- Create general_log
80CREATE TABLE IF NOT EXISTS general_log (event_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), user_host MEDIUMTEXT NOT NULL, thread_id BIGINT(21) UNSIGNED NOT NULL, server_id INTEGER UNSIGNED NOT NULL, command_type VARCHAR(64) NOT NULL, argument MEDIUMBLOB NOT NULL) engine=CSV CHARACTER SET utf8 comment="General log";
81
82-- Create slow_log
83CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), user_host MEDIUMTEXT NOT NULL, query_time TIME(6) NOT NULL, lock_time TIME(6) NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512) NOT NULL, last_insert_id INTEGER NOT NULL, insert_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, sql_text MEDIUMBLOB NOT NULL, thread_id BIGINT(21) UNSIGNED NOT NULL) engine=CSV CHARACTER SET utf8 comment="Slow log";
84
85CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator INTEGER UNSIGNED NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
86
87
88CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts INT UNSIGNED NOT NULL, updates INT UNSIGNED NOT NULL, deletes INT UNSIGNED NOT NULL, schemaops INT UNSIGNED NOT NULL, orig_server_id INT UNSIGNED NOT NULL, orig_epoch BIGINT UNSIGNED NOT NULL, gci INT UNSIGNED NOT NULL, next_position BIGINT UNSIGNED NOT NULL, next_file VARCHAR(255) NOT NULL, PRIMARY KEY(epoch, orig_server_id, orig_epoch)) ENGINE=MYISAM;
89
90SET @sql_mode_orig=@@SESSION.sql_mode;
91SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION';
92
93SET @create_innodb_table_stats="CREATE TABLE IF NOT EXISTS innodb_table_stats (
94 database_name VARCHAR(64) NOT NULL,
95 table_name VARCHAR(64) NOT NULL,
96 last_update TIMESTAMP NOT NULL NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
97 n_rows BIGINT UNSIGNED NOT NULL,
98 clustered_index_size BIGINT UNSIGNED NOT NULL,
99 sum_of_other_index_sizes BIGINT UNSIGNED NOT NULL,
100 PRIMARY KEY (database_name, table_name)
101) ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0";
102
103SET @create_innodb_index_stats="CREATE TABLE IF NOT EXISTS innodb_index_stats (
104 database_name VARCHAR(64) NOT NULL,
105 table_name VARCHAR(64) NOT NULL,
106 index_name VARCHAR(64) NOT NULL,
107 last_update TIMESTAMP NOT NULL NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
108 /* there are at least:
109 stat_name='size'
110 stat_name='n_leaf_pages'
111 stat_name='n_diff_pfx%' */
112 stat_name VARCHAR(64) NOT NULL,
113 stat_value BIGINT UNSIGNED NOT NULL,
114 sample_size BIGINT UNSIGNED,
115 stat_description VARCHAR(1024) NOT NULL,
116 PRIMARY KEY (database_name, table_name, index_name, stat_name)
117) ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0";
118
119set @have_innodb= (select count(engine) from information_schema.engines where engine='INNODB' and support != 'NO');
120
121SET @str=IF(@have_innodb <> 0, @create_innodb_table_stats, "SET @dummy = 0");
122PREPARE stmt FROM @str;
123EXECUTE stmt;
124DROP PREPARE stmt;
125
126SET @str=IF(@have_innodb <> 0, @create_innodb_index_stats, "SET @dummy = 0");
127PREPARE stmt FROM @str;
128EXECUTE stmt;
129DROP PREPARE stmt;
130
131SET SESSION sql_mode=@sql_mode_orig;
132
133SET @cmd="CREATE TABLE IF NOT EXISTS slave_relay_log_info (
134 Number_of_lines INTEGER UNSIGNED NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.',
135 Relay_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.',
136 Relay_log_pos BIGINT UNSIGNED NOT NULL COMMENT 'The relay log position of the last executed event.',
137 Master_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.',
138 Master_log_pos BIGINT UNSIGNED NOT NULL COMMENT 'The master log position of the last executed event.',
139 Sql_delay INTEGER NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',
140 Number_of_workers INTEGER UNSIGNED NOT NULL,
141 Id INTEGER UNSIGNED NOT NULL COMMENT 'Internal Id that uniquely identifies this record.',
142 PRIMARY KEY(Id)) DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT 'Relay Log Information'";
143
144SET @str=IF(@have_innodb <> 0, CONCAT(@cmd, ' ENGINE= INNODB;'), CONCAT(@cmd, ' ENGINE= MYISAM;'));
145PREPARE stmt FROM @str;
146EXECUTE stmt;
147DROP PREPARE stmt;
148
149SET @cmd= "CREATE TABLE IF NOT EXISTS slave_master_info (
150 Number_of_lines INTEGER UNSIGNED NOT NULL COMMENT 'Number of lines in the file.',
151 Master_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log currently being read from the master.',
152 Master_log_pos BIGINT UNSIGNED NOT NULL COMMENT 'The master log position of the last read event.',
153 Host CHAR(64) CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The host name of the master.',
154 User_name TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The user name used to connect to the master.',
155 User_password TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The password used to connect to the master.',
156 Port INTEGER UNSIGNED NOT NULL COMMENT 'The network port used to connect to the master.',
157 Connect_retry INTEGER UNSIGNED NOT NULL COMMENT 'The period (in seconds) that the slave will wait before trying to reconnect to the master.',
158 Enabled_ssl BOOLEAN NOT NULL COMMENT 'Indicates whether the server supports SSL connections.',
159 Ssl_ca TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Authority (CA) certificate.',
160 Ssl_capath TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path to the Certificate Authority (CA) certificates.',
161 Ssl_cert TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL certificate file.',
162 Ssl_cipher TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the cipher in use for the SSL connection.',
163 Ssl_key TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL key file.',
164 Ssl_verify_server_cert BOOLEAN NOT NULL COMMENT 'Whether to verify the server certificate.',
165 Heartbeat FLOAT NOT NULL COMMENT '',
166 Bind TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Displays which interface is employed when connecting to the MySQL server',
167 Ignored_server_ids TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The number of server IDs to be ignored, followed by the actual server IDs',
168 Uuid TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The master server uuid.',
169 Retry_count BIGINT UNSIGNED NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.',
170 Ssl_crl TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Revocation List (CRL)',
171 Ssl_crlpath TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path used for Certificate Revocation List (CRL) files',
172 Enabled_auto_position BOOLEAN NOT NULL COMMENT 'Indicates whether GTIDs will be used to retrieve events from the master.',
173 PRIMARY KEY(Host, Port)) DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT 'Master Information'";
174
175SET @str=IF(@have_innodb <> 0, CONCAT(@cmd, ' ENGINE= INNODB;'), CONCAT(@cmd, ' ENGINE= MYISAM;'));
176PREPARE stmt FROM @str;
177EXECUTE stmt;
178DROP PREPARE stmt;
179
180SET @cmd= "CREATE TABLE IF NOT EXISTS slave_worker_info (
181 Id INTEGER UNSIGNED NOT NULL,
182 Relay_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
183 Relay_log_pos BIGINT UNSIGNED NOT NULL,
184 Master_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
185 Master_log_pos BIGINT UNSIGNED NOT NULL,
186 Checkpoint_relay_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
187 Checkpoint_relay_log_pos BIGINT UNSIGNED NOT NULL,
188 Checkpoint_master_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
189 Checkpoint_master_log_pos BIGINT UNSIGNED NOT NULL,
190 Checkpoint_seqno INT UNSIGNED NOT NULL,
191 Checkpoint_group_size INTEGER UNSIGNED NOT NULL,
192 Checkpoint_group_bitmap BLOB NOT NULL,
193 PRIMARY KEY(Id)) DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT 'Worker Information'";
194
195SET @str=IF(@have_innodb <> 0, CONCAT(@cmd, ' ENGINE= INNODB;'), CONCAT(@cmd, ' ENGINE= MYISAM;'));
196PREPARE stmt FROM @str;
197EXECUTE stmt;
198DROP PREPARE stmt;
199
200SET @cmd= "CREATE TABLE IF NOT EXISTS gtid_executed (
201 source_uuid CHAR(36) NOT NULL COMMENT 'uuid of the source where the transaction was originally executed.',
202 interval_start BIGINT NOT NULL COMMENT 'First number of interval.',
203 interval_end BIGINT NOT NULL COMMENT 'Last number of interval.',
204 PRIMARY KEY(source_uuid, interval_start))";
205
206SET @str=IF(@have_innodb <> 0, CONCAT(@cmd, ' ENGINE= INNODB;'), CONCAT(@cmd, ' ENGINE= MYISAM;'));
207PREPARE stmt FROM @str;
208EXECUTE stmt;
209DROP PREPARE stmt;
210
211--
212-- Optimizer Cost Model configuration
213--
214
215-- Server cost constants
216
217CREATE TABLE IF NOT EXISTS server_cost (
218 cost_name VARCHAR(64) NOT NULL,
219 cost_value FLOAT DEFAULT NULL,
220 last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
221 comment VARCHAR(1024) DEFAULT NULL,
222 PRIMARY KEY (cost_name)
223) ENGINE=InnoDB CHARACTER SET=utf8 COLLATE=utf8_general_ci STATS_PERSISTENT=0;
224
225INSERT IGNORE INTO server_cost VALUES
226 ("row_evaluate_cost", DEFAULT, CURRENT_TIMESTAMP, DEFAULT);
227
228INSERT IGNORE INTO server_cost VALUES
229 ("key_compare_cost", DEFAULT, CURRENT_TIMESTAMP, DEFAULT);
230
231INSERT IGNORE INTO server_cost VALUES
232 ("memory_temptable_create_cost", DEFAULT, CURRENT_TIMESTAMP, DEFAULT);
233
234INSERT IGNORE INTO server_cost VALUES
235 ("memory_temptable_row_cost", DEFAULT, CURRENT_TIMESTAMP, DEFAULT);
236
237INSERT IGNORE INTO server_cost VALUES
238 ("disk_temptable_create_cost", DEFAULT, CURRENT_TIMESTAMP, DEFAULT);
239
240INSERT IGNORE INTO server_cost VALUES
241 ("disk_temptable_row_cost", DEFAULT, CURRENT_TIMESTAMP, DEFAULT);
242
243-- Engine cost constants
244
245CREATE TABLE IF NOT EXISTS engine_cost (
246 engine_name VARCHAR(64) NOT NULL,
247 device_type INTEGER NOT NULL,
248 cost_name VARCHAR(64) NOT NULL,
249 cost_value FLOAT DEFAULT NULL,
250 last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
251 comment VARCHAR(1024) DEFAULT NULL,
252 PRIMARY KEY (cost_name, engine_name, device_type)
253) ENGINE=InnoDB CHARACTER SET=utf8 COLLATE=utf8_general_ci STATS_PERSISTENT=0;
254
255INSERT IGNORE INTO engine_cost VALUES
256 ("default", 0, "io_block_read_cost", DEFAULT, CURRENT_TIMESTAMP, DEFAULT);
257
258--
259-- PERFORMANCE SCHEMA INSTALLATION
260-- Note that this script is also reused by mysql_upgrade,
261-- so we have to be very careful here to not destroy any
262-- existing database named 'performance_schema' if it
263-- can contain user data.
264-- In case of downgrade, it's ok to drop unknown tables
265-- from a future version, as long as they belong to the
266-- performance schema engine.
267--
268
269set @have_old_pfs= (select count(*) from information_schema.schemata where schema_name='performance_schema');
270
271SET @cmd="SET @broken_tables = (select count(*) from information_schema.tables"
272 " where engine != \'PERFORMANCE_SCHEMA\' and table_schema=\'performance_schema\')";
273
274-- Work around for bug#49542
275SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_tables = 0');
276PREPARE stmt FROM @str;
277EXECUTE stmt;
278DROP PREPARE stmt;
279
280SET @cmd="SET @broken_views = (select count(*) from information_schema.views"
281 " where table_schema='performance_schema')";
282
283-- Work around for bug#49542
284SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_views = 0');
285PREPARE stmt FROM @str;
286EXECUTE stmt;
287DROP PREPARE stmt;
288
289SET @broken_routines = (select count(*) from mysql.proc where db='performance_schema');
290
291SET @broken_events = (select count(*) from mysql.event where db='performance_schema');
292
293SET @broken_pfs= (select @broken_tables + @broken_views + @broken_routines + @broken_events);
294
295--
296-- The performance schema database.
297-- Only drop and create the database if this is safe (no broken_pfs).
298-- This database is created, even in --without-perfschema builds,
299-- so that the database name is always reserved by the MySQL implementation.
300--
301
302SET @cmd= "DROP DATABASE IF EXISTS performance_schema";
303
304SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0');
305PREPARE stmt FROM @str;
306EXECUTE stmt;
307DROP PREPARE stmt;
308
309SET @cmd= "CREATE DATABASE performance_schema character set utf8";
310
311SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0');
312PREPARE stmt FROM @str;
313EXECUTE stmt;
314DROP PREPARE stmt;
315
316--
317-- From this point, only create the performance schema tables
318-- if the server is built with performance schema
319--
320
321set @have_pfs= (select count(engine) from information_schema.engines where engine='PERFORMANCE_SCHEMA' and support != 'NO');
322
323--
324-- TABLE COND_INSTANCES
325--
326
327SET @cmd="CREATE TABLE performance_schema.cond_instances("
328 "NAME VARCHAR(128) not null,"
329 "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null"
330 ")ENGINE=PERFORMANCE_SCHEMA;";
331
332SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
333PREPARE stmt FROM @str;
334EXECUTE stmt;
335DROP PREPARE stmt;
336
337--
338-- TABLE EVENTS_WAITS_CURRENT
339--
340
341SET @cmd="CREATE TABLE performance_schema.events_waits_current("
342 "THREAD_ID BIGINT unsigned not null,"
343 "EVENT_ID BIGINT unsigned not null,"
344 "END_EVENT_ID BIGINT unsigned,"
345 "EVENT_NAME VARCHAR(128) not null,"
346 "SOURCE VARCHAR(64),"
347 "TIMER_START BIGINT unsigned,"
348 "TIMER_END BIGINT unsigned,"
349 "TIMER_WAIT BIGINT unsigned,"
350 "SPINS INTEGER unsigned,"
351 "OBJECT_SCHEMA VARCHAR(64),"
352 "OBJECT_NAME VARCHAR(512),"
353 "INDEX_NAME VARCHAR(64),"
354 "OBJECT_TYPE VARCHAR(64),"
355 "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
356 "NESTING_EVENT_ID BIGINT unsigned,"
357 "NESTING_EVENT_TYPE ENUM('TRANSACTION', 'STATEMENT', 'STAGE', 'WAIT'),"
358 "OPERATION VARCHAR(32) not null,"
359 "NUMBER_OF_BYTES BIGINT,"
360 "FLAGS INTEGER unsigned"
361 ")ENGINE=PERFORMANCE_SCHEMA;";
362
363SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
364PREPARE stmt FROM @str;
365EXECUTE stmt;
366DROP PREPARE stmt;
367
368--
369-- TABLE EVENTS_WAITS_HISTORY
370--
371
372SET @cmd="CREATE TABLE performance_schema.events_waits_history("
373 "THREAD_ID BIGINT unsigned not null,"
374 "EVENT_ID BIGINT unsigned not null,"
375 "END_EVENT_ID BIGINT unsigned,"
376 "EVENT_NAME VARCHAR(128) not null,"
377 "SOURCE VARCHAR(64),"
378 "TIMER_START BIGINT unsigned,"
379 "TIMER_END BIGINT unsigned,"
380 "TIMER_WAIT BIGINT unsigned,"
381 "SPINS INTEGER unsigned,"
382 "OBJECT_SCHEMA VARCHAR(64),"
383 "OBJECT_NAME VARCHAR(512),"
384 "INDEX_NAME VARCHAR(64),"
385 "OBJECT_TYPE VARCHAR(64),"
386 "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
387 "NESTING_EVENT_ID BIGINT unsigned,"
388 "NESTING_EVENT_TYPE ENUM('TRANSACTION', 'STATEMENT', 'STAGE', 'WAIT'),"
389 "OPERATION VARCHAR(32) not null,"
390 "NUMBER_OF_BYTES BIGINT,"
391 "FLAGS INTEGER unsigned"
392 ")ENGINE=PERFORMANCE_SCHEMA;";
393
394SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
395PREPARE stmt FROM @str;
396EXECUTE stmt;
397DROP PREPARE stmt;
398
399--
400-- TABLE EVENTS_WAITS_HISTORY_LONG
401--
402
403SET @cmd="CREATE TABLE performance_schema.events_waits_history_long("
404 "THREAD_ID BIGINT unsigned not null,"
405 "EVENT_ID BIGINT unsigned not null,"
406 "END_EVENT_ID BIGINT unsigned,"
407 "EVENT_NAME VARCHAR(128) not null,"
408 "SOURCE VARCHAR(64),"
409 "TIMER_START BIGINT unsigned,"
410 "TIMER_END BIGINT unsigned,"
411 "TIMER_WAIT BIGINT unsigned,"
412 "SPINS INTEGER unsigned,"
413 "OBJECT_SCHEMA VARCHAR(64),"
414 "OBJECT_NAME VARCHAR(512),"
415 "INDEX_NAME VARCHAR(64),"
416 "OBJECT_TYPE VARCHAR(64),"
417 "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
418 "NESTING_EVENT_ID BIGINT unsigned,"
419 "NESTING_EVENT_TYPE ENUM('TRANSACTION', 'STATEMENT', 'STAGE', 'WAIT'),"
420 "OPERATION VARCHAR(32) not null,"
421 "NUMBER_OF_BYTES BIGINT,"
422 "FLAGS INTEGER unsigned"
423 ")ENGINE=PERFORMANCE_SCHEMA;";
424
425SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
426PREPARE stmt FROM @str;
427EXECUTE stmt;
428DROP PREPARE stmt;
429
430--
431-- TABLE EVENTS_WAITS_SUMMARY_BY_INSTANCE
432--
433
434SET @cmd="CREATE TABLE performance_schema.events_waits_summary_by_instance("
435 "EVENT_NAME VARCHAR(128) not null,"
436 "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
437 "COUNT_STAR BIGINT unsigned not null,"
438 "SUM_TIMER_WAIT BIGINT unsigned not null,"
439 "MIN_TIMER_WAIT BIGINT unsigned not null,"
440 "AVG_TIMER_WAIT BIGINT unsigned not null,"
441 "MAX_TIMER_WAIT BIGINT unsigned not null"
442 ")ENGINE=PERFORMANCE_SCHEMA;";
443
444SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
445PREPARE stmt FROM @str;
446EXECUTE stmt;
447DROP PREPARE stmt;
448
449--
450-- TABLE EVENTS_WAITS_SUMMARY_BY_HOST_BY_EVENT_NAME
451--
452
453SET @cmd="CREATE TABLE performance_schema.events_waits_summary_by_host_by_event_name("
454 "HOST CHAR(60) collate utf8_bin default null,"
455 "EVENT_NAME VARCHAR(128) not null,"
456 "COUNT_STAR BIGINT unsigned not null,"
457 "SUM_TIMER_WAIT BIGINT unsigned not null,"
458 "MIN_TIMER_WAIT BIGINT unsigned not null,"
459 "AVG_TIMER_WAIT BIGINT unsigned not null,"
460 "MAX_TIMER_WAIT BIGINT unsigned not null"
461 ")ENGINE=PERFORMANCE_SCHEMA;";
462
463SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
464PREPARE stmt FROM @str;
465EXECUTE stmt;
466DROP PREPARE stmt;
467
468--
469-- TABLE EVENTS_WAITS_SUMMARY_BY_USER_BY_EVENT_NAME
470--
471
472SET @cmd="CREATE TABLE performance_schema.events_waits_summary_by_user_by_event_name("
473 "USER CHAR(16) collate utf8_bin default null,"
474 "EVENT_NAME VARCHAR(128) not null,"
475 "COUNT_STAR BIGINT unsigned not null,"
476 "SUM_TIMER_WAIT BIGINT unsigned not null,"
477 "MIN_TIMER_WAIT BIGINT unsigned not null,"
478 "AVG_TIMER_WAIT BIGINT unsigned not null,"
479 "MAX_TIMER_WAIT BIGINT unsigned not null"
480 ")ENGINE=PERFORMANCE_SCHEMA;";
481
482SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
483PREPARE stmt FROM @str;
484EXECUTE stmt;
485DROP PREPARE stmt;
486
487--
488-- TABLE EVENTS_WAITS_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME
489--
490
491SET @cmd="CREATE TABLE performance_schema.events_waits_summary_by_account_by_event_name("
492 "USER CHAR(16) collate utf8_bin default null,"
493 "HOST CHAR(60) collate utf8_bin default null,"
494 "EVENT_NAME VARCHAR(128) not null,"
495 "COUNT_STAR BIGINT unsigned not null,"
496 "SUM_TIMER_WAIT BIGINT unsigned not null,"
497 "MIN_TIMER_WAIT BIGINT unsigned not null,"
498 "AVG_TIMER_WAIT BIGINT unsigned not null,"
499 "MAX_TIMER_WAIT BIGINT unsigned not null"
500 ")ENGINE=PERFORMANCE_SCHEMA;";
501
502SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
503PREPARE stmt FROM @str;
504EXECUTE stmt;
505DROP PREPARE stmt;
506
507--
508-- TABLE EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
509--
510
511SET @cmd="CREATE TABLE performance_schema.events_waits_summary_by_thread_by_event_name("
512 "THREAD_ID BIGINT unsigned not null,"
513 "EVENT_NAME VARCHAR(128) not null,"
514 "COUNT_STAR BIGINT unsigned not null,"
515 "SUM_TIMER_WAIT BIGINT unsigned not null,"
516 "MIN_TIMER_WAIT BIGINT unsigned not null,"
517 "AVG_TIMER_WAIT BIGINT unsigned not null,"
518 "MAX_TIMER_WAIT BIGINT unsigned not null"
519 ")ENGINE=PERFORMANCE_SCHEMA;";
520
521SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
522PREPARE stmt FROM @str;
523EXECUTE stmt;
524DROP PREPARE stmt;
525
526--
527-- TABLE EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
528--
529
530SET @cmd="CREATE TABLE performance_schema.events_waits_summary_global_by_event_name("
531 "EVENT_NAME VARCHAR(128) not null,"
532 "COUNT_STAR BIGINT unsigned not null,"
533 "SUM_TIMER_WAIT BIGINT unsigned not null,"
534 "MIN_TIMER_WAIT BIGINT unsigned not null,"
535 "AVG_TIMER_WAIT BIGINT unsigned not null,"
536 "MAX_TIMER_WAIT BIGINT unsigned not null"
537 ")ENGINE=PERFORMANCE_SCHEMA;";
538
539SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
540PREPARE stmt FROM @str;
541EXECUTE stmt;
542DROP PREPARE stmt;
543
544--
545-- TABLE FILE_INSTANCES
546--
547
548SET @cmd="CREATE TABLE performance_schema.file_instances("
549 "FILE_NAME VARCHAR(512) not null,"
550 "EVENT_NAME VARCHAR(128) not null,"
551 "OPEN_COUNT INTEGER unsigned not null"
552 ")ENGINE=PERFORMANCE_SCHEMA;";
553
554SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
555PREPARE stmt FROM @str;
556EXECUTE stmt;
557DROP PREPARE stmt;
558
559--
560-- TABLE FILE_SUMMARY_BY_EVENT_NAME
561--
562
563SET @cmd="CREATE TABLE performance_schema.file_summary_by_event_name("
564 "EVENT_NAME VARCHAR(128) not null,"
565 "COUNT_STAR BIGINT unsigned not null,"
566 "SUM_TIMER_WAIT BIGINT unsigned not null,"
567 "MIN_TIMER_WAIT BIGINT unsigned not null,"
568 "AVG_TIMER_WAIT BIGINT unsigned not null,"
569 "MAX_TIMER_WAIT BIGINT unsigned not null,"
570 "COUNT_READ BIGINT unsigned not null,"
571 "SUM_TIMER_READ BIGINT unsigned not null,"
572 "MIN_TIMER_READ BIGINT unsigned not null,"
573 "AVG_TIMER_READ BIGINT unsigned not null,"
574 "MAX_TIMER_READ BIGINT unsigned not null,"
575 "SUM_NUMBER_OF_BYTES_READ BIGINT not null,"
576 "COUNT_WRITE BIGINT unsigned not null,"
577 "SUM_TIMER_WRITE BIGINT unsigned not null,"
578 "MIN_TIMER_WRITE BIGINT unsigned not null,"
579 "AVG_TIMER_WRITE BIGINT unsigned not null,"
580 "MAX_TIMER_WRITE BIGINT unsigned not null,"
581 "SUM_NUMBER_OF_BYTES_WRITE BIGINT not null,"
582 "COUNT_MISC BIGINT unsigned not null,"
583 "SUM_TIMER_MISC BIGINT unsigned not null,"
584 "MIN_TIMER_MISC BIGINT unsigned not null,"
585 "AVG_TIMER_MISC BIGINT unsigned not null,"
586 "MAX_TIMER_MISC BIGINT unsigned not null"
587 ")ENGINE=PERFORMANCE_SCHEMA;";
588
589SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
590PREPARE stmt FROM @str;
591EXECUTE stmt;
592DROP PREPARE stmt;
593
594--
595-- TABLE FILE_SUMMARY_BY_INSTANCE
596--
597
598SET @cmd="CREATE TABLE performance_schema.file_summary_by_instance("
599 "FILE_NAME VARCHAR(512) not null,"
600 "EVENT_NAME VARCHAR(128) not null,"
601 "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
602 "COUNT_STAR BIGINT unsigned not null,"
603 "SUM_TIMER_WAIT BIGINT unsigned not null,"
604 "MIN_TIMER_WAIT BIGINT unsigned not null,"
605 "AVG_TIMER_WAIT BIGINT unsigned not null,"
606 "MAX_TIMER_WAIT BIGINT unsigned not null,"
607 "COUNT_READ BIGINT unsigned not null,"
608 "SUM_TIMER_READ BIGINT unsigned not null,"
609 "MIN_TIMER_READ BIGINT unsigned not null,"
610 "AVG_TIMER_READ BIGINT unsigned not null,"
611 "MAX_TIMER_READ BIGINT unsigned not null,"
612 "SUM_NUMBER_OF_BYTES_READ BIGINT not null,"
613 "COUNT_WRITE BIGINT unsigned not null,"
614 "SUM_TIMER_WRITE BIGINT unsigned not null,"
615 "MIN_TIMER_WRITE BIGINT unsigned not null,"
616 "AVG_TIMER_WRITE BIGINT unsigned not null,"
617 "MAX_TIMER_WRITE BIGINT unsigned not null,"
618 "SUM_NUMBER_OF_BYTES_WRITE BIGINT not null,"
619 "COUNT_MISC BIGINT unsigned not null,"
620 "SUM_TIMER_MISC BIGINT unsigned not null,"
621 "MIN_TIMER_MISC BIGINT unsigned not null,"
622 "AVG_TIMER_MISC BIGINT unsigned not null,"
623 "MAX_TIMER_MISC BIGINT unsigned not null"
624 ")ENGINE=PERFORMANCE_SCHEMA;";
625
626SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
627PREPARE stmt FROM @str;
628EXECUTE stmt;
629DROP PREPARE stmt;
630
631
632--
633-- TABLE SOCKET_INSTANCES
634--
635
636SET @cmd="CREATE TABLE performance_schema.socket_instances("
637 "EVENT_NAME VARCHAR(128) not null,"
638 "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
639 "THREAD_ID BIGINT unsigned,"
640 "SOCKET_ID INTEGER not null,"
641 "IP VARCHAR(64) not null,"
642 "PORT INTEGER not null,"
643 "STATE ENUM('IDLE','ACTIVE') not null"
644 ")ENGINE=PERFORMANCE_SCHEMA;";
645
646SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
647PREPARE stmt FROM @str;
648EXECUTE stmt;
649DROP PREPARE stmt;
650
651--
652-- TABLE SOCKET_SUMMARY_BY_INSTANCE
653--
654
655SET @cmd="CREATE TABLE performance_schema.socket_summary_by_instance("
656 "EVENT_NAME VARCHAR(128) not null,"
657 "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
658 "COUNT_STAR BIGINT unsigned not null,"
659 "SUM_TIMER_WAIT BIGINT unsigned not null,"
660 "MIN_TIMER_WAIT BIGINT unsigned not null,"
661 "AVG_TIMER_WAIT BIGINT unsigned not null,"
662 "MAX_TIMER_WAIT BIGINT unsigned not null,"
663 "COUNT_READ BIGINT unsigned not null,"
664 "SUM_TIMER_READ BIGINT unsigned not null,"
665 "MIN_TIMER_READ BIGINT unsigned not null,"
666 "AVG_TIMER_READ BIGINT unsigned not null,"
667 "MAX_TIMER_READ BIGINT unsigned not null,"
668 "SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,"
669 "COUNT_WRITE BIGINT unsigned not null,"
670 "SUM_TIMER_WRITE BIGINT unsigned not null,"
671 "MIN_TIMER_WRITE BIGINT unsigned not null,"
672 "AVG_TIMER_WRITE BIGINT unsigned not null,"
673 "MAX_TIMER_WRITE BIGINT unsigned not null,"
674 "SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null,"
675 "COUNT_MISC BIGINT unsigned not null,"
676 "SUM_TIMER_MISC BIGINT unsigned not null,"
677 "MIN_TIMER_MISC BIGINT unsigned not null,"
678 "AVG_TIMER_MISC BIGINT unsigned not null,"
679 "MAX_TIMER_MISC BIGINT unsigned not null"
680 ")ENGINE=PERFORMANCE_SCHEMA;";
681
682SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
683PREPARE stmt FROM @str;
684EXECUTE stmt;
685DROP PREPARE stmt;
686
687--
688-- TABLE SOCKET_SUMMARY_BY_INSTANCE
689--
690
691SET @cmd="CREATE TABLE performance_schema.socket_summary_by_event_name("
692 "EVENT_NAME VARCHAR(128) not null,"
693 "COUNT_STAR BIGINT unsigned not null,"
694 "SUM_TIMER_WAIT BIGINT unsigned not null,"
695 "MIN_TIMER_WAIT BIGINT unsigned not null,"
696 "AVG_TIMER_WAIT BIGINT unsigned not null,"
697 "MAX_TIMER_WAIT BIGINT unsigned not null,"
698 "COUNT_READ BIGINT unsigned not null,"
699 "SUM_TIMER_READ BIGINT unsigned not null,"
700 "MIN_TIMER_READ BIGINT unsigned not null,"
701 "AVG_TIMER_READ BIGINT unsigned not null,"
702 "MAX_TIMER_READ BIGINT unsigned not null,"
703 "SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,"
704 "COUNT_WRITE BIGINT unsigned not null,"
705 "SUM_TIMER_WRITE BIGINT unsigned not null,"
706 "MIN_TIMER_WRITE BIGINT unsigned not null,"
707 "AVG_TIMER_WRITE BIGINT unsigned not null,"
708 "MAX_TIMER_WRITE BIGINT unsigned not null,"
709 "SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null,"
710 "COUNT_MISC BIGINT unsigned not null,"
711 "SUM_TIMER_MISC BIGINT unsigned not null,"
712 "MIN_TIMER_MISC BIGINT unsigned not null,"
713 "AVG_TIMER_MISC BIGINT unsigned not null,"
714 "MAX_TIMER_MISC BIGINT unsigned not null"
715 ")ENGINE=PERFORMANCE_SCHEMA;";
716
717SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
718PREPARE stmt FROM @str;
719EXECUTE stmt;
720DROP PREPARE stmt;
721
722--
723-- TABLE HOST_CACHE
724--
725
726SET @cmd="CREATE TABLE performance_schema.host_cache("
727 "IP VARCHAR(64) not null,"
728 "HOST VARCHAR(255) collate utf8_bin,"
729 "HOST_VALIDATED ENUM ('YES', 'NO') not null,"
730 "SUM_CONNECT_ERRORS BIGINT not null,"
731 "COUNT_HOST_BLOCKED_ERRORS BIGINT not null,"
732 "COUNT_NAMEINFO_TRANSIENT_ERRORS BIGINT not null,"
733 "COUNT_NAMEINFO_PERMANENT_ERRORS BIGINT not null,"
734 "COUNT_FORMAT_ERRORS BIGINT not null,"
735 "COUNT_ADDRINFO_TRANSIENT_ERRORS BIGINT not null,"
736 "COUNT_ADDRINFO_PERMANENT_ERRORS BIGINT not null,"
737 "COUNT_FCRDNS_ERRORS BIGINT not null,"
738 "COUNT_HOST_ACL_ERRORS BIGINT not null,"
739 "COUNT_NO_AUTH_PLUGIN_ERRORS BIGINT not null,"
740 "COUNT_AUTH_PLUGIN_ERRORS BIGINT not null,"
741 "COUNT_HANDSHAKE_ERRORS BIGINT not null,"
742 "COUNT_PROXY_USER_ERRORS BIGINT not null,"
743 "COUNT_PROXY_USER_ACL_ERRORS BIGINT not null,"
744 "COUNT_AUTHENTICATION_ERRORS BIGINT not null,"
745 "COUNT_SSL_ERRORS BIGINT not null,"
746 "COUNT_MAX_USER_CONNECTIONS_ERRORS BIGINT not null,"
747 "COUNT_MAX_USER_CONNECTIONS_PER_HOUR_ERRORS BIGINT not null,"
748 "COUNT_DEFAULT_DATABASE_ERRORS BIGINT not null,"
749 "COUNT_INIT_CONNECT_ERRORS BIGINT not null,"
750 "COUNT_LOCAL_ERRORS BIGINT not null,"
751 "COUNT_UNKNOWN_ERRORS BIGINT not null,"
752 "FIRST_SEEN TIMESTAMP(0) NOT NULL default 0,"
753 "LAST_SEEN TIMESTAMP(0) NOT NULL default 0,"
754 "FIRST_ERROR_SEEN TIMESTAMP(0) null default 0,"
755 "LAST_ERROR_SEEN TIMESTAMP(0) null default 0"
756 ")ENGINE=PERFORMANCE_SCHEMA;";
757
758SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
759PREPARE stmt FROM @str;
760EXECUTE stmt;
761DROP PREPARE stmt;
762
763--
764-- TABLE MUTEX_INSTANCES
765--
766
767SET @cmd="CREATE TABLE performance_schema.mutex_instances("
768 "NAME VARCHAR(128) not null,"
769 "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
770 "LOCKED_BY_THREAD_ID BIGINT unsigned"
771 ")ENGINE=PERFORMANCE_SCHEMA;";
772
773SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
774PREPARE stmt FROM @str;
775EXECUTE stmt;
776DROP PREPARE stmt;
777
778--
779-- TABLE OBJECTS_SUMMARY_GLOBAL_BY_TYPE
780--
781
782SET @cmd="CREATE TABLE performance_schema.objects_summary_global_by_type("
783 "OBJECT_TYPE VARCHAR(64),"
784 "OBJECT_SCHEMA VARCHAR(64),"
785 "OBJECT_NAME VARCHAR(64),"
786 "COUNT_STAR BIGINT unsigned not null,"
787 "SUM_TIMER_WAIT BIGINT unsigned not null,"
788 "MIN_TIMER_WAIT BIGINT unsigned not null,"
789 "AVG_TIMER_WAIT BIGINT unsigned not null,"
790 "MAX_TIMER_WAIT BIGINT unsigned not null"
791 ")ENGINE=PERFORMANCE_SCHEMA;";
792
793SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
794PREPARE stmt FROM @str;
795EXECUTE stmt;
796DROP PREPARE stmt;
797
798--
799-- TABLE PERFORMANCE_TIMERS
800--
801
802SET @cmd="CREATE TABLE performance_schema.performance_timers("
803 "TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null,"
804 "TIMER_FREQUENCY BIGINT,"
805 "TIMER_RESOLUTION BIGINT,"
806 "TIMER_OVERHEAD BIGINT"
807 ") ENGINE=PERFORMANCE_SCHEMA;";
808
809SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
810PREPARE stmt FROM @str;
811EXECUTE stmt;
812DROP PREPARE stmt;
813
814--
815-- TABLE RWLOCK_INSTANCES
816--
817
818SET @cmd="CREATE TABLE performance_schema.rwlock_instances("
819 "NAME VARCHAR(128) not null,"
820 "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
821 "WRITE_LOCKED_BY_THREAD_ID BIGINT unsigned,"
822 "READ_LOCKED_BY_COUNT INTEGER unsigned not null"
823 ")ENGINE=PERFORMANCE_SCHEMA;";
824
825SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
826PREPARE stmt FROM @str;
827EXECUTE stmt;
828DROP PREPARE stmt;
829
830--
831-- TABLE SETUP_ACTORS
832--
833
834SET @cmd="CREATE TABLE performance_schema.setup_actors("
835 "HOST CHAR(60) collate utf8_bin default '%' not null,"
836 "USER CHAR(16) collate utf8_bin default '%' not null,"
837 "ROLE CHAR(16) collate utf8_bin default '%' not null"
838 ")ENGINE=PERFORMANCE_SCHEMA;";
839
840SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
841PREPARE stmt FROM @str;
842EXECUTE stmt;
843DROP PREPARE stmt;
844
845--
846-- TABLE SETUP_CONSUMERS
847--
848
849SET @cmd="CREATE TABLE performance_schema.setup_consumers("
850 "NAME VARCHAR(64) not null,"
851 "ENABLED ENUM ('YES', 'NO') not null"
852 ")ENGINE=PERFORMANCE_SCHEMA;";
853
854SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
855PREPARE stmt FROM @str;
856EXECUTE stmt;
857DROP PREPARE stmt;
858
859--
860-- TABLE SETUP_INSTRUMENTS
861--
862
863SET @cmd="CREATE TABLE performance_schema.setup_instruments("
864 "NAME VARCHAR(128) not null,"
865 "ENABLED ENUM ('YES', 'NO') not null,"
866 "TIMED ENUM ('YES', 'NO') not null"
867 ")ENGINE=PERFORMANCE_SCHEMA;";
868
869SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
870PREPARE stmt FROM @str;
871EXECUTE stmt;
872DROP PREPARE stmt;
873
874--
875-- TABLE SETUP_OBJECTS
876--
877
878SET @cmd="CREATE TABLE performance_schema.setup_objects("
879 "OBJECT_TYPE ENUM ('EVENT', 'FUNCTION', 'PROCEDURE', 'TABLE', 'TRIGGER') not null default 'TABLE',"
880 "OBJECT_SCHEMA VARCHAR(64) default '%',"
881 "OBJECT_NAME VARCHAR(64) not null default '%',"
882 "ENABLED ENUM ('YES', 'NO') not null default 'YES',"
883 "TIMED ENUM ('YES', 'NO') not null default 'YES'"
884 ")ENGINE=PERFORMANCE_SCHEMA;";
885
886SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
887PREPARE stmt FROM @str;
888EXECUTE stmt;
889DROP PREPARE stmt;
890
891--
892-- TABLE SETUP_TIMERS
893--
894
895SET @cmd="CREATE TABLE performance_schema.setup_timers("
896 "NAME VARCHAR(64) not null,"
897 "TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null"
898 ")ENGINE=PERFORMANCE_SCHEMA;";
899
900SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
901PREPARE stmt FROM @str;
902EXECUTE stmt;
903DROP PREPARE stmt;
904
905--
906-- TABLE TABLE_IO_WAITS_SUMMARY_BY_INDEX_USAGE
907--
908
909SET @cmd="CREATE TABLE performance_schema.table_io_waits_summary_by_index_usage("
910 "OBJECT_TYPE VARCHAR(64),"
911 "OBJECT_SCHEMA VARCHAR(64),"
912 "OBJECT_NAME VARCHAR(64),"
913 "INDEX_NAME VARCHAR(64),"
914 "COUNT_STAR BIGINT unsigned not null,"
915 "SUM_TIMER_WAIT BIGINT unsigned not null,"
916 "MIN_TIMER_WAIT BIGINT unsigned not null,"
917 "AVG_TIMER_WAIT BIGINT unsigned not null,"
918 "MAX_TIMER_WAIT BIGINT unsigned not null,"
919 "COUNT_READ BIGINT unsigned not null,"
920 "SUM_TIMER_READ BIGINT unsigned not null,"
921 "MIN_TIMER_READ BIGINT unsigned not null,"
922 "AVG_TIMER_READ BIGINT unsigned not null,"
923 "MAX_TIMER_READ BIGINT unsigned not null,"
924 "COUNT_WRITE BIGINT unsigned not null,"
925 "SUM_TIMER_WRITE BIGINT unsigned not null,"
926 "MIN_TIMER_WRITE BIGINT unsigned not null,"
927 "AVG_TIMER_WRITE BIGINT unsigned not null,"
928 "MAX_TIMER_WRITE BIGINT unsigned not null,"
929 "COUNT_FETCH BIGINT unsigned not null,"
930 "SUM_TIMER_FETCH BIGINT unsigned not null,"
931 "MIN_TIMER_FETCH BIGINT unsigned not null,"
932 "AVG_TIMER_FETCH BIGINT unsigned not null,"
933 "MAX_TIMER_FETCH BIGINT unsigned not null,"
934 "COUNT_INSERT BIGINT unsigned not null,"
935 "SUM_TIMER_INSERT BIGINT unsigned not null,"
936 "MIN_TIMER_INSERT BIGINT unsigned not null,"
937 "AVG_TIMER_INSERT BIGINT unsigned not null,"
938 "MAX_TIMER_INSERT BIGINT unsigned not null,"
939 "COUNT_UPDATE BIGINT unsigned not null,"
940 "SUM_TIMER_UPDATE BIGINT unsigned not null,"
941 "MIN_TIMER_UPDATE BIGINT unsigned not null,"
942 "AVG_TIMER_UPDATE BIGINT unsigned not null,"
943 "MAX_TIMER_UPDATE BIGINT unsigned not null,"
944 "COUNT_DELETE BIGINT unsigned not null,"
945 "SUM_TIMER_DELETE BIGINT unsigned not null,"
946 "MIN_TIMER_DELETE BIGINT unsigned not null,"
947 "AVG_TIMER_DELETE BIGINT unsigned not null,"
948 "MAX_TIMER_DELETE BIGINT unsigned not null"
949 ")ENGINE=PERFORMANCE_SCHEMA;";
950
951SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
952PREPARE stmt FROM @str;
953EXECUTE stmt;
954DROP PREPARE stmt;
955
956--
957-- TABLE TABLE_IO_WAITS_SUMMARY_BY_TABLE
958--
959
960SET @cmd="CREATE TABLE performance_schema.table_io_waits_summary_by_table("
961 "OBJECT_TYPE VARCHAR(64),"
962 "OBJECT_SCHEMA VARCHAR(64),"
963 "OBJECT_NAME VARCHAR(64),"
964 "COUNT_STAR BIGINT unsigned not null,"
965 "SUM_TIMER_WAIT BIGINT unsigned not null,"
966 "MIN_TIMER_WAIT BIGINT unsigned not null,"
967 "AVG_TIMER_WAIT BIGINT unsigned not null,"
968 "MAX_TIMER_WAIT BIGINT unsigned not null,"
969 "COUNT_READ BIGINT unsigned not null,"
970 "SUM_TIMER_READ BIGINT unsigned not null,"
971 "MIN_TIMER_READ BIGINT unsigned not null,"
972 "AVG_TIMER_READ BIGINT unsigned not null,"
973 "MAX_TIMER_READ BIGINT unsigned not null,"
974 "COUNT_WRITE BIGINT unsigned not null,"
975 "SUM_TIMER_WRITE BIGINT unsigned not null,"
976 "MIN_TIMER_WRITE BIGINT unsigned not null,"
977 "AVG_TIMER_WRITE BIGINT unsigned not null,"
978 "MAX_TIMER_WRITE BIGINT unsigned not null,"
979 "COUNT_FETCH BIGINT unsigned not null,"
980 "SUM_TIMER_FETCH BIGINT unsigned not null,"
981 "MIN_TIMER_FETCH BIGINT unsigned not null,"
982 "AVG_TIMER_FETCH BIGINT unsigned not null,"
983 "MAX_TIMER_FETCH BIGINT unsigned not null,"
984 "COUNT_INSERT BIGINT unsigned not null,"
985 "SUM_TIMER_INSERT BIGINT unsigned not null,"
986 "MIN_TIMER_INSERT BIGINT unsigned not null,"
987 "AVG_TIMER_INSERT BIGINT unsigned not null,"
988 "MAX_TIMER_INSERT BIGINT unsigned not null,"
989 "COUNT_UPDATE BIGINT unsigned not null,"
990 "SUM_TIMER_UPDATE BIGINT unsigned not null,"
991 "MIN_TIMER_UPDATE BIGINT unsigned not null,"
992 "AVG_TIMER_UPDATE BIGINT unsigned not null,"
993 "MAX_TIMER_UPDATE BIGINT unsigned not null,"
994 "COUNT_DELETE BIGINT unsigned not null,"
995 "SUM_TIMER_DELETE BIGINT unsigned not null,"
996 "MIN_TIMER_DELETE BIGINT unsigned not null,"
997 "AVG_TIMER_DELETE BIGINT unsigned not null,"
998 "MAX_TIMER_DELETE BIGINT unsigned not null"
999 ")ENGINE=PERFORMANCE_SCHEMA;";
1000
1001SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1002PREPARE stmt FROM @str;
1003EXECUTE stmt;
1004DROP PREPARE stmt;
1005
1006--
1007-- TABLE TABLE_LOCK_WAITS_SUMMARY_BY_TABLE
1008--
1009
1010SET @cmd="CREATE TABLE performance_schema.table_lock_waits_summary_by_table("
1011 "OBJECT_TYPE VARCHAR(64),"
1012 "OBJECT_SCHEMA VARCHAR(64),"
1013 "OBJECT_NAME VARCHAR(64),"
1014 "COUNT_STAR BIGINT unsigned not null,"
1015 "SUM_TIMER_WAIT BIGINT unsigned not null,"
1016 "MIN_TIMER_WAIT BIGINT unsigned not null,"
1017 "AVG_TIMER_WAIT BIGINT unsigned not null,"
1018 "MAX_TIMER_WAIT BIGINT unsigned not null,"
1019 "COUNT_READ BIGINT unsigned not null,"
1020 "SUM_TIMER_READ BIGINT unsigned not null,"
1021 "MIN_TIMER_READ BIGINT unsigned not null,"
1022 "AVG_TIMER_READ BIGINT unsigned not null,"
1023 "MAX_TIMER_READ BIGINT unsigned not null,"
1024 "COUNT_WRITE BIGINT unsigned not null,"
1025 "SUM_TIMER_WRITE BIGINT unsigned not null,"
1026 "MIN_TIMER_WRITE BIGINT unsigned not null,"
1027 "AVG_TIMER_WRITE BIGINT unsigned not null,"
1028 "MAX_TIMER_WRITE BIGINT unsigned not null,"
1029 "COUNT_READ_NORMAL BIGINT unsigned not null,"
1030 "SUM_TIMER_READ_NORMAL BIGINT unsigned not null,"
1031 "MIN_TIMER_READ_NORMAL BIGINT unsigned not null,"
1032 "AVG_TIMER_READ_NORMAL BIGINT unsigned not null,"
1033 "MAX_TIMER_READ_NORMAL BIGINT unsigned not null,"
1034 "COUNT_READ_WITH_SHARED_LOCKS BIGINT unsigned not null,"
1035 "SUM_TIMER_READ_WITH_SHARED_LOCKS BIGINT unsigned not null,"
1036 "MIN_TIMER_READ_WITH_SHARED_LOCKS BIGINT unsigned not null,"
1037 "AVG_TIMER_READ_WITH_SHARED_LOCKS BIGINT unsigned not null,"
1038 "MAX_TIMER_READ_WITH_SHARED_LOCKS BIGINT unsigned not null,"
1039 "COUNT_READ_HIGH_PRIORITY BIGINT unsigned not null,"
1040 "SUM_TIMER_READ_HIGH_PRIORITY BIGINT unsigned not null,"
1041 "MIN_TIMER_READ_HIGH_PRIORITY BIGINT unsigned not null,"
1042 "AVG_TIMER_READ_HIGH_PRIORITY BIGINT unsigned not null,"
1043 "MAX_TIMER_READ_HIGH_PRIORITY BIGINT unsigned not null,"
1044 "COUNT_READ_NO_INSERT BIGINT unsigned not null,"
1045 "SUM_TIMER_READ_NO_INSERT BIGINT unsigned not null,"
1046 "MIN_TIMER_READ_NO_INSERT BIGINT unsigned not null,"
1047 "AVG_TIMER_READ_NO_INSERT BIGINT unsigned not null,"
1048 "MAX_TIMER_READ_NO_INSERT BIGINT unsigned not null,"
1049 "COUNT_READ_EXTERNAL BIGINT unsigned not null,"
1050 "SUM_TIMER_READ_EXTERNAL BIGINT unsigned not null,"
1051 "MIN_TIMER_READ_EXTERNAL BIGINT unsigned not null,"
1052 "AVG_TIMER_READ_EXTERNAL BIGINT unsigned not null,"
1053 "MAX_TIMER_READ_EXTERNAL BIGINT unsigned not null,"
1054 "COUNT_WRITE_ALLOW_WRITE BIGINT unsigned not null,"
1055 "SUM_TIMER_WRITE_ALLOW_WRITE BIGINT unsigned not null,"
1056 "MIN_TIMER_WRITE_ALLOW_WRITE BIGINT unsigned not null,"
1057 "AVG_TIMER_WRITE_ALLOW_WRITE BIGINT unsigned not null,"
1058 "MAX_TIMER_WRITE_ALLOW_WRITE BIGINT unsigned not null,"
1059 "COUNT_WRITE_CONCURRENT_INSERT BIGINT unsigned not null,"
1060 "SUM_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null,"
1061 "MIN_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null,"
1062 "AVG_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null,"
1063 "MAX_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null,"
1064 "COUNT_WRITE_LOW_PRIORITY BIGINT unsigned not null,"
1065 "SUM_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null,"
1066 "MIN_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null,"
1067 "AVG_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null,"
1068 "MAX_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null,"
1069 "COUNT_WRITE_NORMAL BIGINT unsigned not null,"
1070 "SUM_TIMER_WRITE_NORMAL BIGINT unsigned not null,"
1071 "MIN_TIMER_WRITE_NORMAL BIGINT unsigned not null,"
1072 "AVG_TIMER_WRITE_NORMAL BIGINT unsigned not null,"
1073 "MAX_TIMER_WRITE_NORMAL BIGINT unsigned not null,"
1074 "COUNT_WRITE_EXTERNAL BIGINT unsigned not null,"
1075 "SUM_TIMER_WRITE_EXTERNAL BIGINT unsigned not null,"
1076 "MIN_TIMER_WRITE_EXTERNAL BIGINT unsigned not null,"
1077 "AVG_TIMER_WRITE_EXTERNAL BIGINT unsigned not null,"
1078 "MAX_TIMER_WRITE_EXTERNAL BIGINT unsigned not null"
1079 ")ENGINE=PERFORMANCE_SCHEMA;";
1080
1081SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1082PREPARE stmt FROM @str;
1083EXECUTE stmt;
1084DROP PREPARE stmt;
1085
1086--
1087-- TABLE THREADS
1088--
1089
1090SET @cmd="CREATE TABLE performance_schema.threads("
1091 "THREAD_ID BIGINT unsigned not null,"
1092 "NAME VARCHAR(128) not null,"
1093 "TYPE VARCHAR(10) not null,"
1094 "PROCESSLIST_ID BIGINT unsigned,"
1095 "PROCESSLIST_USER VARCHAR(16),"
1096 "PROCESSLIST_HOST VARCHAR(60),"
1097 "PROCESSLIST_DB VARCHAR(64),"
1098 "PROCESSLIST_COMMAND VARCHAR(16),"
1099 "PROCESSLIST_TIME BIGINT,"
1100 "PROCESSLIST_STATE VARCHAR(64),"
1101 "PROCESSLIST_INFO LONGTEXT,"
1102 "PARENT_THREAD_ID BIGINT unsigned,"
1103 "ROLE VARCHAR(64),"
1104 "INSTRUMENTED ENUM ('YES', 'NO') not null"
1105 ")ENGINE=PERFORMANCE_SCHEMA;";
1106
1107SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1108PREPARE stmt FROM @str;
1109EXECUTE stmt;
1110DROP PREPARE stmt;
1111
1112--
1113-- TABLE EVENTS_STAGES_CURRENT
1114--
1115
1116SET @cmd="CREATE TABLE performance_schema.events_stages_current("
1117 "THREAD_ID BIGINT unsigned not null,"
1118 "EVENT_ID BIGINT unsigned not null,"
1119 "END_EVENT_ID BIGINT unsigned,"
1120 "EVENT_NAME VARCHAR(128) not null,"
1121 "SOURCE VARCHAR(64),"
1122 "TIMER_START BIGINT unsigned,"
1123 "TIMER_END BIGINT unsigned,"
1124 "TIMER_WAIT BIGINT unsigned,"
1125 "WORK_COMPLETED BIGINT unsigned,"
1126 "WORK_ESTIMATED BIGINT unsigned,"
1127 "NESTING_EVENT_ID BIGINT unsigned,"
1128 "NESTING_EVENT_TYPE ENUM('TRANSACTION', 'STATEMENT', 'STAGE', 'WAIT')"
1129 ")ENGINE=PERFORMANCE_SCHEMA;";
1130
1131SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1132PREPARE stmt FROM @str;
1133EXECUTE stmt;
1134DROP PREPARE stmt;
1135
1136--
1137-- TABLE EVENTS_STAGES_HISTORY
1138--
1139
1140SET @cmd="CREATE TABLE performance_schema.events_stages_history("
1141 "THREAD_ID BIGINT unsigned not null,"
1142 "EVENT_ID BIGINT unsigned not null,"
1143 "END_EVENT_ID BIGINT unsigned,"
1144 "EVENT_NAME VARCHAR(128) not null,"
1145 "SOURCE VARCHAR(64),"
1146 "TIMER_START BIGINT unsigned,"
1147 "TIMER_END BIGINT unsigned,"
1148 "TIMER_WAIT BIGINT unsigned,"
1149 "WORK_COMPLETED BIGINT unsigned,"
1150 "WORK_ESTIMATED BIGINT unsigned,"
1151 "NESTING_EVENT_ID BIGINT unsigned,"
1152 "NESTING_EVENT_TYPE ENUM('TRANSACTION', 'STATEMENT', 'STAGE', 'WAIT')"
1153 ")ENGINE=PERFORMANCE_SCHEMA;";
1154
1155SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1156PREPARE stmt FROM @str;
1157EXECUTE stmt;
1158DROP PREPARE stmt;
1159
1160--
1161-- TABLE EVENTS_STAGES_HISTORY_LONG
1162--
1163
1164SET @cmd="CREATE TABLE performance_schema.events_stages_history_long("
1165 "THREAD_ID BIGINT unsigned not null,"
1166 "EVENT_ID BIGINT unsigned not null,"
1167 "END_EVENT_ID BIGINT unsigned,"
1168 "EVENT_NAME VARCHAR(128) not null,"
1169 "SOURCE VARCHAR(64),"
1170 "TIMER_START BIGINT unsigned,"
1171 "TIMER_END BIGINT unsigned,"
1172 "TIMER_WAIT BIGINT unsigned,"
1173 "WORK_COMPLETED BIGINT unsigned,"
1174 "WORK_ESTIMATED BIGINT unsigned,"
1175 "NESTING_EVENT_ID BIGINT unsigned,"
1176 "NESTING_EVENT_TYPE ENUM('TRANSACTION', 'STATEMENT', 'STAGE', 'WAIT')"
1177 ")ENGINE=PERFORMANCE_SCHEMA;";
1178
1179SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1180PREPARE stmt FROM @str;
1181EXECUTE stmt;
1182DROP PREPARE stmt;
1183
1184--
1185-- TABLE EVENTS_STAGES_SUMMARY_BY_THREAD_BY_EVENT_NAME
1186--
1187
1188SET @cmd="CREATE TABLE performance_schema.events_stages_summary_by_thread_by_event_name("
1189 "THREAD_ID BIGINT unsigned not null,"
1190 "EVENT_NAME VARCHAR(128) not null,"
1191 "COUNT_STAR BIGINT unsigned not null,"
1192 "SUM_TIMER_WAIT BIGINT unsigned not null,"
1193 "MIN_TIMER_WAIT BIGINT unsigned not null,"
1194 "AVG_TIMER_WAIT BIGINT unsigned not null,"
1195 "MAX_TIMER_WAIT BIGINT unsigned not null"
1196 ")ENGINE=PERFORMANCE_SCHEMA;";
1197
1198SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1199PREPARE stmt FROM @str;
1200EXECUTE stmt;
1201DROP PREPARE stmt;
1202
1203--
1204-- TABLE EVENTS_STAGES_SUMMARY_BY_HOST_BY_EVENT_NAME
1205--
1206
1207SET @cmd="CREATE TABLE performance_schema.events_stages_summary_by_host_by_event_name("
1208 "HOST CHAR(60) collate utf8_bin default null,"
1209 "EVENT_NAME VARCHAR(128) not null,"
1210 "COUNT_STAR BIGINT unsigned not null,"
1211 "SUM_TIMER_WAIT BIGINT unsigned not null,"
1212 "MIN_TIMER_WAIT BIGINT unsigned not null,"
1213 "AVG_TIMER_WAIT BIGINT unsigned not null,"
1214 "MAX_TIMER_WAIT BIGINT unsigned not null"
1215 ")ENGINE=PERFORMANCE_SCHEMA;";
1216
1217SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1218PREPARE stmt FROM @str;
1219EXECUTE stmt;
1220DROP PREPARE stmt;
1221
1222--
1223-- TABLE EVENTS_STAGES_SUMMARY_BY_USER_BY_EVENT_NAME
1224--
1225
1226SET @cmd="CREATE TABLE performance_schema.events_stages_summary_by_user_by_event_name("
1227 "USER CHAR(16) collate utf8_bin default null,"
1228 "EVENT_NAME VARCHAR(128) not null,"
1229 "COUNT_STAR BIGINT unsigned not null,"
1230 "SUM_TIMER_WAIT BIGINT unsigned not null,"
1231 "MIN_TIMER_WAIT BIGINT unsigned not null,"
1232 "AVG_TIMER_WAIT BIGINT unsigned not null,"
1233 "MAX_TIMER_WAIT BIGINT unsigned not null"
1234 ")ENGINE=PERFORMANCE_SCHEMA;";
1235
1236SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1237PREPARE stmt FROM @str;
1238EXECUTE stmt;
1239DROP PREPARE stmt;
1240
1241--
1242-- TABLE EVENTS_STAGES_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME
1243--
1244
1245SET @cmd="CREATE TABLE performance_schema.events_stages_summary_by_account_by_event_name("
1246 "USER CHAR(16) collate utf8_bin default null,"
1247 "HOST CHAR(60) collate utf8_bin default null,"
1248 "EVENT_NAME VARCHAR(128) not null,"
1249 "COUNT_STAR BIGINT unsigned not null,"
1250 "SUM_TIMER_WAIT BIGINT unsigned not null,"
1251 "MIN_TIMER_WAIT BIGINT unsigned not null,"
1252 "AVG_TIMER_WAIT BIGINT unsigned not null,"
1253 "MAX_TIMER_WAIT BIGINT unsigned not null"
1254 ")ENGINE=PERFORMANCE_SCHEMA;";
1255
1256SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1257PREPARE stmt FROM @str;
1258EXECUTE stmt;
1259DROP PREPARE stmt;
1260
1261--
1262-- TABLE EVENTS_STAGES_SUMMARY_GLOBAL_BY_EVENT_NAME
1263--
1264
1265SET @cmd="CREATE TABLE performance_schema.events_stages_summary_global_by_event_name("
1266 "EVENT_NAME VARCHAR(128) not null,"
1267 "COUNT_STAR BIGINT unsigned not null,"
1268 "SUM_TIMER_WAIT BIGINT unsigned not null,"
1269 "MIN_TIMER_WAIT BIGINT unsigned not null,"
1270 "AVG_TIMER_WAIT BIGINT unsigned not null,"
1271 "MAX_TIMER_WAIT BIGINT unsigned not null"
1272 ")ENGINE=PERFORMANCE_SCHEMA;";
1273
1274SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1275PREPARE stmt FROM @str;
1276EXECUTE stmt;
1277DROP PREPARE stmt;
1278
1279--
1280-- TABLE EVENTS_STATEMENTS_CURRENT
1281--
1282
1283SET @cmd="CREATE TABLE performance_schema.events_statements_current("
1284 "THREAD_ID BIGINT unsigned not null,"
1285 "EVENT_ID BIGINT unsigned not null,"
1286 "END_EVENT_ID BIGINT unsigned,"
1287 "EVENT_NAME VARCHAR(128) not null,"
1288 "SOURCE VARCHAR(64),"
1289 "TIMER_START BIGINT unsigned,"
1290 "TIMER_END BIGINT unsigned,"
1291 "TIMER_WAIT BIGINT unsigned,"
1292 "LOCK_TIME bigint unsigned not null,"
1293 "SQL_TEXT LONGTEXT,"
1294 "DIGEST VARCHAR(32),"
1295 "DIGEST_TEXT LONGTEXT,"
1296 "CURRENT_SCHEMA VARCHAR(64),"
1297 "OBJECT_TYPE VARCHAR(64),"
1298 "OBJECT_SCHEMA VARCHAR(64),"
1299 "OBJECT_NAME VARCHAR(64),"
1300 "OBJECT_INSTANCE_BEGIN BIGINT unsigned,"
1301 "MYSQL_ERRNO INTEGER,"
1302 "RETURNED_SQLSTATE VARCHAR(5),"
1303 "MESSAGE_TEXT VARCHAR(128),"
1304 "ERRORS BIGINT unsigned not null,"
1305 "WARNINGS BIGINT unsigned not null,"
1306 "ROWS_AFFECTED BIGINT unsigned not null,"
1307 "ROWS_SENT BIGINT unsigned not null,"
1308 "ROWS_EXAMINED BIGINT unsigned not null,"
1309 "CREATED_TMP_DISK_TABLES BIGINT unsigned not null,"
1310 "CREATED_TMP_TABLES BIGINT unsigned not null,"
1311 "SELECT_FULL_JOIN BIGINT unsigned not null,"
1312 "SELECT_FULL_RANGE_JOIN BIGINT unsigned not null,"
1313 "SELECT_RANGE BIGINT unsigned not null,"
1314 "SELECT_RANGE_CHECK BIGINT unsigned not null,"
1315 "SELECT_SCAN BIGINT unsigned not null,"
1316 "SORT_MERGE_PASSES BIGINT unsigned not null,"
1317 "SORT_RANGE BIGINT unsigned not null,"
1318 "SORT_ROWS BIGINT unsigned not null,"
1319 "SORT_SCAN BIGINT unsigned not null,"
1320 "NO_INDEX_USED BIGINT unsigned not null,"
1321 "NO_GOOD_INDEX_USED BIGINT unsigned not null,"
1322 "NESTING_EVENT_ID BIGINT unsigned,"
1323 "NESTING_EVENT_TYPE ENUM('TRANSACTION', 'STATEMENT', 'STAGE', 'WAIT'),"
1324 "NESTING_EVENT_LEVEL INTEGER"
1325 ")ENGINE=PERFORMANCE_SCHEMA;";
1326
1327SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1328PREPARE stmt FROM @str;
1329EXECUTE stmt;
1330DROP PREPARE stmt;
1331
1332--
1333-- TABLE EVENTS_STATEMENTS_HISTORY
1334--
1335
1336SET @cmd="CREATE TABLE performance_schema.events_statements_history("
1337 "THREAD_ID BIGINT unsigned not null,"
1338 "EVENT_ID BIGINT unsigned not null,"
1339 "END_EVENT_ID BIGINT unsigned,"
1340 "EVENT_NAME VARCHAR(128) not null,"
1341 "SOURCE VARCHAR(64),"
1342 "TIMER_START BIGINT unsigned,"
1343 "TIMER_END BIGINT unsigned,"
1344 "TIMER_WAIT BIGINT unsigned,"
1345 "LOCK_TIME bigint unsigned not null,"
1346 "SQL_TEXT LONGTEXT,"
1347 "DIGEST VARCHAR(32),"
1348 "DIGEST_TEXT LONGTEXT,"
1349 "CURRENT_SCHEMA VARCHAR(64),"
1350 "OBJECT_TYPE VARCHAR(64),"
1351 "OBJECT_SCHEMA VARCHAR(64),"
1352 "OBJECT_NAME VARCHAR(64),"
1353 "OBJECT_INSTANCE_BEGIN BIGINT unsigned,"
1354 "MYSQL_ERRNO INTEGER,"
1355 "RETURNED_SQLSTATE VARCHAR(5),"
1356 "MESSAGE_TEXT VARCHAR(128),"
1357 "ERRORS BIGINT unsigned not null,"
1358 "WARNINGS BIGINT unsigned not null,"
1359 "ROWS_AFFECTED BIGINT unsigned not null,"
1360 "ROWS_SENT BIGINT unsigned not null,"
1361 "ROWS_EXAMINED BIGINT unsigned not null,"
1362 "CREATED_TMP_DISK_TABLES BIGINT unsigned not null,"
1363 "CREATED_TMP_TABLES BIGINT unsigned not null,"
1364 "SELECT_FULL_JOIN BIGINT unsigned not null,"
1365 "SELECT_FULL_RANGE_JOIN BIGINT unsigned not null,"
1366 "SELECT_RANGE BIGINT unsigned not null,"
1367 "SELECT_RANGE_CHECK BIGINT unsigned not null,"
1368 "SELECT_SCAN BIGINT unsigned not null,"
1369 "SORT_MERGE_PASSES BIGINT unsigned not null,"
1370 "SORT_RANGE BIGINT unsigned not null,"
1371 "SORT_ROWS BIGINT unsigned not null,"
1372 "SORT_SCAN BIGINT unsigned not null,"
1373 "NO_INDEX_USED BIGINT unsigned not null,"
1374 "NO_GOOD_INDEX_USED BIGINT unsigned not null,"
1375 "NESTING_EVENT_ID BIGINT unsigned,"
1376 "NESTING_EVENT_TYPE ENUM('TRANSACTION', 'STATEMENT', 'STAGE', 'WAIT'),"
1377 "NESTING_EVENT_LEVEL INTEGER"
1378 ")ENGINE=PERFORMANCE_SCHEMA;";
1379
1380SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1381PREPARE stmt FROM @str;
1382EXECUTE stmt;
1383DROP PREPARE stmt;
1384
1385--
1386-- TABLE EVENTS_STATEMENTS_HISTORY_LONG
1387--
1388
1389SET @cmd="CREATE TABLE performance_schema.events_statements_history_long("
1390 "THREAD_ID BIGINT unsigned not null,"
1391 "EVENT_ID BIGINT unsigned not null,"
1392 "END_EVENT_ID BIGINT unsigned,"
1393 "EVENT_NAME VARCHAR(128) not null,"
1394 "SOURCE VARCHAR(64),"
1395 "TIMER_START BIGINT unsigned,"
1396 "TIMER_END BIGINT unsigned,"
1397 "TIMER_WAIT BIGINT unsigned,"
1398 "LOCK_TIME bigint unsigned not null,"
1399 "SQL_TEXT LONGTEXT,"
1400 "DIGEST VARCHAR(32),"
1401 "DIGEST_TEXT LONGTEXT,"
1402 "CURRENT_SCHEMA VARCHAR(64),"
1403 "OBJECT_TYPE VARCHAR(64),"
1404 "OBJECT_SCHEMA VARCHAR(64),"
1405 "OBJECT_NAME VARCHAR(64),"
1406 "OBJECT_INSTANCE_BEGIN BIGINT unsigned,"
1407 "MYSQL_ERRNO INTEGER,"
1408 "RETURNED_SQLSTATE VARCHAR(5),"
1409 "MESSAGE_TEXT VARCHAR(128),"
1410 "ERRORS BIGINT unsigned not null,"
1411 "WARNINGS BIGINT unsigned not null,"
1412 "ROWS_AFFECTED BIGINT unsigned not null,"
1413 "ROWS_SENT BIGINT unsigned not null,"
1414 "ROWS_EXAMINED BIGINT unsigned not null,"
1415 "CREATED_TMP_DISK_TABLES BIGINT unsigned not null,"
1416 "CREATED_TMP_TABLES BIGINT unsigned not null,"
1417 "SELECT_FULL_JOIN BIGINT unsigned not null,"
1418 "SELECT_FULL_RANGE_JOIN BIGINT unsigned not null,"
1419 "SELECT_RANGE BIGINT unsigned not null,"
1420 "SELECT_RANGE_CHECK BIGINT unsigned not null,"
1421 "SELECT_SCAN BIGINT unsigned not null,"
1422 "SORT_MERGE_PASSES BIGINT unsigned not null,"
1423 "SORT_RANGE BIGINT unsigned not null,"
1424 "SORT_ROWS BIGINT unsigned not null,"
1425 "SORT_SCAN BIGINT unsigned not null,"
1426 "NO_INDEX_USED BIGINT unsigned not null,"
1427 "NO_GOOD_INDEX_USED BIGINT unsigned not null,"
1428 "NESTING_EVENT_ID BIGINT unsigned,"
1429 "NESTING_EVENT_TYPE ENUM('TRANSACTION', 'STATEMENT', 'STAGE', 'WAIT'),"
1430 "NESTING_EVENT_LEVEL INTEGER"
1431 ")ENGINE=PERFORMANCE_SCHEMA;";
1432
1433SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1434PREPARE stmt FROM @str;
1435EXECUTE stmt;
1436DROP PREPARE stmt;
1437
1438--
1439-- TABLE EVENTS_STATEMENTS_SUMMARY_BY_THREAD_BY_EVENT_NAME
1440--
1441
1442SET @cmd="CREATE TABLE performance_schema.events_statements_summary_by_thread_by_event_name("
1443 "THREAD_ID BIGINT unsigned not null,"
1444 "EVENT_NAME VARCHAR(128) not null,"
1445 "COUNT_STAR BIGINT unsigned not null,"
1446 "SUM_TIMER_WAIT BIGINT unsigned not null,"
1447 "MIN_TIMER_WAIT BIGINT unsigned not null,"
1448 "AVG_TIMER_WAIT BIGINT unsigned not null,"
1449 "MAX_TIMER_WAIT BIGINT unsigned not null,"
1450 "SUM_LOCK_TIME BIGINT unsigned not null,"
1451 "SUM_ERRORS BIGINT unsigned not null,"
1452 "SUM_WARNINGS BIGINT unsigned not null,"
1453 "SUM_ROWS_AFFECTED BIGINT unsigned not null,"
1454 "SUM_ROWS_SENT BIGINT unsigned not null,"
1455 "SUM_ROWS_EXAMINED BIGINT unsigned not null,"
1456 "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null,"
1457 "SUM_CREATED_TMP_TABLES BIGINT unsigned not null,"
1458 "SUM_SELECT_FULL_JOIN BIGINT unsigned not null,"
1459 "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null,"
1460 "SUM_SELECT_RANGE BIGINT unsigned not null,"
1461 "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null,"
1462 "SUM_SELECT_SCAN BIGINT unsigned not null,"
1463 "SUM_SORT_MERGE_PASSES BIGINT unsigned not null,"
1464 "SUM_SORT_RANGE BIGINT unsigned not null,"
1465 "SUM_SORT_ROWS BIGINT unsigned not null,"
1466 "SUM_SORT_SCAN BIGINT unsigned not null,"
1467 "SUM_NO_INDEX_USED BIGINT unsigned not null,"
1468 "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null"
1469 ")ENGINE=PERFORMANCE_SCHEMA;";
1470
1471SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1472PREPARE stmt FROM @str;
1473EXECUTE stmt;
1474DROP PREPARE stmt;
1475
1476--
1477-- TABLE EVENTS_STATEMENTS_SUMMARY_BY_HOST_BY_EVENT_NAME
1478--
1479
1480SET @cmd="CREATE TABLE performance_schema.events_statements_summary_by_host_by_event_name("
1481 "HOST CHAR(60) collate utf8_bin default null,"
1482 "EVENT_NAME VARCHAR(128) not null,"
1483 "COUNT_STAR BIGINT unsigned not null,"
1484 "SUM_TIMER_WAIT BIGINT unsigned not null,"
1485 "MIN_TIMER_WAIT BIGINT unsigned not null,"
1486 "AVG_TIMER_WAIT BIGINT unsigned not null,"
1487 "MAX_TIMER_WAIT BIGINT unsigned not null,"
1488 "SUM_LOCK_TIME BIGINT unsigned not null,"
1489 "SUM_ERRORS BIGINT unsigned not null,"
1490 "SUM_WARNINGS BIGINT unsigned not null,"
1491 "SUM_ROWS_AFFECTED BIGINT unsigned not null,"
1492 "SUM_ROWS_SENT BIGINT unsigned not null,"
1493 "SUM_ROWS_EXAMINED BIGINT unsigned not null,"
1494 "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null,"
1495 "SUM_CREATED_TMP_TABLES BIGINT unsigned not null,"
1496 "SUM_SELECT_FULL_JOIN BIGINT unsigned not null,"
1497 "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null,"
1498 "SUM_SELECT_RANGE BIGINT unsigned not null,"
1499 "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null,"
1500 "SUM_SELECT_SCAN BIGINT unsigned not null,"
1501 "SUM_SORT_MERGE_PASSES BIGINT unsigned not null,"
1502 "SUM_SORT_RANGE BIGINT unsigned not null,"
1503 "SUM_SORT_ROWS BIGINT unsigned not null,"
1504 "SUM_SORT_SCAN BIGINT unsigned not null,"
1505 "SUM_NO_INDEX_USED BIGINT unsigned not null,"
1506 "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null"
1507 ")ENGINE=PERFORMANCE_SCHEMA;";
1508
1509SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1510PREPARE stmt FROM @str;
1511EXECUTE stmt;
1512DROP PREPARE stmt;
1513
1514--
1515-- TABLE EVENTS_STATEMENTS_SUMMARY_BY_USER_BY_EVENT_NAME
1516--
1517
1518SET @cmd="CREATE TABLE performance_schema.events_statements_summary_by_user_by_event_name("
1519 "USER CHAR(16) collate utf8_bin default null,"
1520 "EVENT_NAME VARCHAR(128) not null,"
1521 "COUNT_STAR BIGINT unsigned not null,"
1522 "SUM_TIMER_WAIT BIGINT unsigned not null,"
1523 "MIN_TIMER_WAIT BIGINT unsigned not null,"
1524 "AVG_TIMER_WAIT BIGINT unsigned not null,"
1525 "MAX_TIMER_WAIT BIGINT unsigned not null,"
1526 "SUM_LOCK_TIME BIGINT unsigned not null,"
1527 "SUM_ERRORS BIGINT unsigned not null,"
1528 "SUM_WARNINGS BIGINT unsigned not null,"
1529 "SUM_ROWS_AFFECTED BIGINT unsigned not null,"
1530 "SUM_ROWS_SENT BIGINT unsigned not null,"
1531 "SUM_ROWS_EXAMINED BIGINT unsigned not null,"
1532 "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null,"
1533 "SUM_CREATED_TMP_TABLES BIGINT unsigned not null,"
1534 "SUM_SELECT_FULL_JOIN BIGINT unsigned not null,"
1535 "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null,"
1536 "SUM_SELECT_RANGE BIGINT unsigned not null,"
1537 "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null,"
1538 "SUM_SELECT_SCAN BIGINT unsigned not null,"
1539 "SUM_SORT_MERGE_PASSES BIGINT unsigned not null,"
1540 "SUM_SORT_RANGE BIGINT unsigned not null,"
1541 "SUM_SORT_ROWS BIGINT unsigned not null,"
1542 "SUM_SORT_SCAN BIGINT unsigned not null,"
1543 "SUM_NO_INDEX_USED BIGINT unsigned not null,"
1544 "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null"
1545 ")ENGINE=PERFORMANCE_SCHEMA;";
1546
1547SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1548PREPARE stmt FROM @str;
1549EXECUTE stmt;
1550DROP PREPARE stmt;
1551
1552--
1553-- TABLE EVENTS_STATEMENTS_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME
1554--
1555
1556SET @cmd="CREATE TABLE performance_schema.events_statements_summary_by_account_by_event_name("
1557 "USER CHAR(16) collate utf8_bin default null,"
1558 "HOST CHAR(60) collate utf8_bin default null,"
1559 "EVENT_NAME VARCHAR(128) not null,"
1560 "COUNT_STAR BIGINT unsigned not null,"
1561 "SUM_TIMER_WAIT BIGINT unsigned not null,"
1562 "MIN_TIMER_WAIT BIGINT unsigned not null,"
1563 "AVG_TIMER_WAIT BIGINT unsigned not null,"
1564 "MAX_TIMER_WAIT BIGINT unsigned not null,"
1565 "SUM_LOCK_TIME BIGINT unsigned not null,"
1566 "SUM_ERRORS BIGINT unsigned not null,"
1567 "SUM_WARNINGS BIGINT unsigned not null,"
1568 "SUM_ROWS_AFFECTED BIGINT unsigned not null,"
1569 "SUM_ROWS_SENT BIGINT unsigned not null,"
1570 "SUM_ROWS_EXAMINED BIGINT unsigned not null,"
1571 "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null,"
1572 "SUM_CREATED_TMP_TABLES BIGINT unsigned not null,"
1573 "SUM_SELECT_FULL_JOIN BIGINT unsigned not null,"
1574 "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null,"
1575 "SUM_SELECT_RANGE BIGINT unsigned not null,"
1576 "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null,"
1577 "SUM_SELECT_SCAN BIGINT unsigned not null,"
1578 "SUM_SORT_MERGE_PASSES BIGINT unsigned not null,"
1579 "SUM_SORT_RANGE BIGINT unsigned not null,"
1580 "SUM_SORT_ROWS BIGINT unsigned not null,"
1581 "SUM_SORT_SCAN BIGINT unsigned not null,"
1582 "SUM_NO_INDEX_USED BIGINT unsigned not null,"
1583 "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null"
1584 ")ENGINE=PERFORMANCE_SCHEMA;";
1585
1586SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1587PREPARE stmt FROM @str;
1588EXECUTE stmt;
1589DROP PREPARE stmt;
1590
1591--
1592-- TABLE EVENTS_STATEMENTS_SUMMARY_GLOBAL_BY_EVENT_NAME
1593--
1594
1595SET @cmd="CREATE TABLE performance_schema.events_statements_summary_global_by_event_name("
1596 "EVENT_NAME VARCHAR(128) not null,"
1597 "COUNT_STAR BIGINT unsigned not null,"
1598 "SUM_TIMER_WAIT BIGINT unsigned not null,"
1599 "MIN_TIMER_WAIT BIGINT unsigned not null,"
1600 "AVG_TIMER_WAIT BIGINT unsigned not null,"
1601 "MAX_TIMER_WAIT BIGINT unsigned not null,"
1602 "SUM_LOCK_TIME BIGINT unsigned not null,"
1603 "SUM_ERRORS BIGINT unsigned not null,"
1604 "SUM_WARNINGS BIGINT unsigned not null,"
1605 "SUM_ROWS_AFFECTED BIGINT unsigned not null,"
1606 "SUM_ROWS_SENT BIGINT unsigned not null,"
1607 "SUM_ROWS_EXAMINED BIGINT unsigned not null,"
1608 "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null,"
1609 "SUM_CREATED_TMP_TABLES BIGINT unsigned not null,"
1610 "SUM_SELECT_FULL_JOIN BIGINT unsigned not null,"
1611 "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null,"
1612 "SUM_SELECT_RANGE BIGINT unsigned not null,"
1613 "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null,"
1614 "SUM_SELECT_SCAN BIGINT unsigned not null,"
1615 "SUM_SORT_MERGE_PASSES BIGINT unsigned not null,"
1616 "SUM_SORT_RANGE BIGINT unsigned not null,"
1617 "SUM_SORT_ROWS BIGINT unsigned not null,"
1618 "SUM_SORT_SCAN BIGINT unsigned not null,"
1619 "SUM_NO_INDEX_USED BIGINT unsigned not null,"
1620 "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null"
1621 ")ENGINE=PERFORMANCE_SCHEMA;";
1622
1623SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1624PREPARE stmt FROM @str;
1625EXECUTE stmt;
1626DROP PREPARE stmt;
1627
1628--
1629-- TABLE EVENTS_TRANSACTIONS_CURRENT
1630--
1631
1632SET @cmd="CREATE TABLE performance_schema.events_transactions_current("
1633 "THREAD_ID BIGINT unsigned not null,"
1634 "EVENT_ID BIGINT unsigned not null,"
1635 "END_EVENT_ID BIGINT unsigned,"
1636 "EVENT_NAME VARCHAR(128) not null,"
1637 "STATE ENUM('ACTIVE', 'COMMITTED', 'ROLLED BACK'),"
1638 "TRX_ID BIGINT unsigned,"
1639 "GTID VARCHAR(64),"
1640 "XID VARCHAR(132),"
1641 "XA_STATE VARCHAR(64),"
1642 "SOURCE VARCHAR(64),"
1643 "TIMER_START BIGINT unsigned,"
1644 "TIMER_END BIGINT unsigned,"
1645 "TIMER_WAIT BIGINT unsigned,"
1646 "ACCESS_MODE ENUM('READ ONLY', 'READ WRITE'),"
1647 "ISOLATION_LEVEL VARCHAR(64),"
1648 "AUTOCOMMIT ENUM('YES','NO') not null,"
1649 "NUMBER_OF_SAVEPOINTS BIGINT unsigned,"
1650 "NUMBER_OF_ROLLBACK_TO_SAVEPOINT BIGINT unsigned,"
1651 "NUMBER_OF_RELEASE_SAVEPOINT BIGINT unsigned,"
1652 "OBJECT_INSTANCE_BEGIN BIGINT unsigned,"
1653 "NESTING_EVENT_ID BIGINT unsigned,"
1654 "NESTING_EVENT_TYPE ENUM('TRANSACTION', 'STATEMENT', 'STAGE', 'WAIT')"
1655 ")ENGINE=PERFORMANCE_SCHEMA;";
1656
1657SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1658PREPARE stmt FROM @str;
1659EXECUTE stmt;
1660DROP PREPARE stmt;
1661
1662--
1663-- TABLE EVENTS_TRANSACTIONS_HISTORY
1664--
1665
1666SET @cmd="CREATE TABLE performance_schema.events_transactions_history("
1667 "THREAD_ID BIGINT unsigned not null,"
1668 "EVENT_ID BIGINT unsigned not null,"
1669 "END_EVENT_ID BIGINT unsigned,"
1670 "EVENT_NAME VARCHAR(128) not null,"
1671 "STATE ENUM('ACTIVE', 'COMMITTED', 'ROLLED BACK'),"
1672 "TRX_ID BIGINT unsigned,"
1673 "GTID VARCHAR(64),"
1674 "XID VARCHAR(132),"
1675 "XA_STATE VARCHAR(64),"
1676 "SOURCE VARCHAR(64),"
1677 "TIMER_START BIGINT unsigned,"
1678 "TIMER_END BIGINT unsigned,"
1679 "TIMER_WAIT BIGINT unsigned,"
1680 "ACCESS_MODE ENUM('READ ONLY', 'READ WRITE'),"
1681 "ISOLATION_LEVEL VARCHAR(64),"
1682 "AUTOCOMMIT ENUM('YES','NO') not null,"
1683 "NUMBER_OF_SAVEPOINTS BIGINT unsigned,"
1684 "NUMBER_OF_ROLLBACK_TO_SAVEPOINT BIGINT unsigned,"
1685 "NUMBER_OF_RELEASE_SAVEPOINT BIGINT unsigned,"
1686 "OBJECT_INSTANCE_BEGIN BIGINT unsigned,"
1687 "NESTING_EVENT_ID BIGINT unsigned,"
1688 "NESTING_EVENT_TYPE ENUM('TRANSACTION', 'STATEMENT', 'STAGE', 'WAIT')"
1689 ")ENGINE=PERFORMANCE_SCHEMA;";
1690
1691SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1692PREPARE stmt FROM @str;
1693EXECUTE stmt;
1694DROP PREPARE stmt;
1695
1696--
1697-- TABLE EVENTS_TRANSACTIONS_HISTORY_LONG
1698--
1699
1700SET @cmd="CREATE TABLE performance_schema.events_transactions_history_long("
1701 "THREAD_ID BIGINT unsigned not null,"
1702 "EVENT_ID BIGINT unsigned not null,"
1703 "END_EVENT_ID BIGINT unsigned,"
1704 "EVENT_NAME VARCHAR(128) not null,"
1705 "STATE ENUM('ACTIVE', 'COMMITTED', 'ROLLED BACK'),"
1706 "TRX_ID BIGINT unsigned,"
1707 "GTID VARCHAR(64),"
1708 "XID VARCHAR(132),"
1709 "XA_STATE VARCHAR(64),"
1710 "SOURCE VARCHAR(64),"
1711 "TIMER_START BIGINT unsigned,"
1712 "TIMER_END BIGINT unsigned,"
1713 "TIMER_WAIT BIGINT unsigned,"
1714 "ACCESS_MODE ENUM('READ ONLY', 'READ WRITE'),"
1715 "ISOLATION_LEVEL VARCHAR(64),"
1716 "AUTOCOMMIT ENUM('YES','NO') not null,"
1717 "NUMBER_OF_SAVEPOINTS BIGINT unsigned,"
1718 "NUMBER_OF_ROLLBACK_TO_SAVEPOINT BIGINT unsigned,"
1719 "NUMBER_OF_RELEASE_SAVEPOINT BIGINT unsigned,"
1720 "OBJECT_INSTANCE_BEGIN BIGINT unsigned,"
1721 "NESTING_EVENT_ID BIGINT unsigned,"
1722 "NESTING_EVENT_TYPE ENUM('TRANSACTION', 'STATEMENT', 'STAGE', 'WAIT')"
1723 ")ENGINE=PERFORMANCE_SCHEMA;";
1724
1725SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1726PREPARE stmt FROM @str;
1727EXECUTE stmt;
1728DROP PREPARE stmt;
1729
1730--
1731-- TABLE EVENTS_TRANSACTIONS_SUMMARY_BY_THREAD_BY_EVENT_NAME
1732--
1733
1734SET @cmd="CREATE TABLE performance_schema.events_transactions_summary_by_thread_by_event_name("
1735 "THREAD_ID BIGINT unsigned not null,"
1736 "EVENT_NAME VARCHAR(128) not null,"
1737 "COUNT_STAR BIGINT unsigned not null,"
1738 "SUM_TIMER_WAIT BIGINT unsigned not null,"
1739 "MIN_TIMER_WAIT BIGINT unsigned not null,"
1740 "AVG_TIMER_WAIT BIGINT unsigned not null,"
1741 "MAX_TIMER_WAIT BIGINT unsigned not null,"
1742 "COUNT_READ_WRITE BIGINT unsigned not null,"
1743 "SUM_TIMER_READ_WRITE BIGINT unsigned not null,"
1744 "MIN_TIMER_READ_WRITE BIGINT unsigned not null,"
1745 "AVG_TIMER_READ_WRITE BIGINT unsigned not null,"
1746 "MAX_TIMER_READ_WRITE BIGINT unsigned not null,"
1747 "COUNT_READ_ONLY BIGINT unsigned not null,"
1748 "SUM_TIMER_READ_ONLY BIGINT unsigned not null,"
1749 "MIN_TIMER_READ_ONLY BIGINT unsigned not null,"
1750 "AVG_TIMER_READ_ONLY BIGINT unsigned not null,"
1751 "MAX_TIMER_READ_ONLY BIGINT unsigned not null"
1752 ")ENGINE=PERFORMANCE_SCHEMA;";
1753
1754SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1755PREPARE stmt FROM @str;
1756EXECUTE stmt;
1757DROP PREPARE stmt;
1758
1759--
1760-- TABLE EVENTS_TRANSACTIONS_SUMMARY_BY_HOST_BY_EVENT_NAME
1761--
1762
1763SET @cmd="CREATE TABLE performance_schema.events_transactions_summary_by_host_by_event_name("
1764 "HOST CHAR(60) collate utf8_bin default null,"
1765 "EVENT_NAME VARCHAR(128) not null,"
1766 "COUNT_STAR BIGINT unsigned not null,"
1767 "SUM_TIMER_WAIT BIGINT unsigned not null,"
1768 "MIN_TIMER_WAIT BIGINT unsigned not null,"
1769 "AVG_TIMER_WAIT BIGINT unsigned not null,"
1770 "MAX_TIMER_WAIT BIGINT unsigned not null,"
1771 "COUNT_READ_WRITE BIGINT unsigned not null,"
1772 "SUM_TIMER_READ_WRITE BIGINT unsigned not null,"
1773 "MIN_TIMER_READ_WRITE BIGINT unsigned not null,"
1774 "AVG_TIMER_READ_WRITE BIGINT unsigned not null,"
1775 "MAX_TIMER_READ_WRITE BIGINT unsigned not null,"
1776 "COUNT_READ_ONLY BIGINT unsigned not null,"
1777 "SUM_TIMER_READ_ONLY BIGINT unsigned not null,"
1778 "MIN_TIMER_READ_ONLY BIGINT unsigned not null,"
1779 "AVG_TIMER_READ_ONLY BIGINT unsigned not null,"
1780 "MAX_TIMER_READ_ONLY BIGINT unsigned not null"
1781 ")ENGINE=PERFORMANCE_SCHEMA;";
1782
1783SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1784PREPARE stmt FROM @str;
1785EXECUTE stmt;
1786DROP PREPARE stmt;
1787
1788--
1789-- TABLE EVENTS_TRANSACTIONS_SUMMARY_BY_USER_BY_EVENT_NAME
1790--
1791
1792SET @cmd="CREATE TABLE performance_schema.events_transactions_summary_by_user_by_event_name("
1793 "USER CHAR(16) collate utf8_bin default null,"
1794 "EVENT_NAME VARCHAR(128) not null,"
1795 "COUNT_STAR BIGINT unsigned not null,"
1796 "SUM_TIMER_WAIT BIGINT unsigned not null,"
1797 "MIN_TIMER_WAIT BIGINT unsigned not null,"
1798 "AVG_TIMER_WAIT BIGINT unsigned not null,"
1799 "MAX_TIMER_WAIT BIGINT unsigned not null,"
1800 "COUNT_READ_WRITE BIGINT unsigned not null,"
1801 "SUM_TIMER_READ_WRITE BIGINT unsigned not null,"
1802 "MIN_TIMER_READ_WRITE BIGINT unsigned not null,"
1803 "AVG_TIMER_READ_WRITE BIGINT unsigned not null,"
1804 "MAX_TIMER_READ_WRITE BIGINT unsigned not null,"
1805 "COUNT_READ_ONLY BIGINT unsigned not null,"
1806 "SUM_TIMER_READ_ONLY BIGINT unsigned not null,"
1807 "MIN_TIMER_READ_ONLY BIGINT unsigned not null,"
1808 "AVG_TIMER_READ_ONLY BIGINT unsigned not null,"
1809 "MAX_TIMER_READ_ONLY BIGINT unsigned not null"
1810 ")ENGINE=PERFORMANCE_SCHEMA;";
1811
1812SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1813PREPARE stmt FROM @str;
1814EXECUTE stmt;
1815DROP PREPARE stmt;
1816
1817--
1818-- TABLE EVENTS_TRANSACTIONS_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME
1819--
1820
1821SET @cmd="CREATE TABLE performance_schema.events_transactions_summary_by_account_by_event_name("
1822 "USER CHAR(16) collate utf8_bin default null,"
1823 "HOST CHAR(60) collate utf8_bin default null,"
1824 "EVENT_NAME VARCHAR(128) not null,"
1825 "COUNT_STAR BIGINT unsigned not null,"
1826 "SUM_TIMER_WAIT BIGINT unsigned not null,"
1827 "MIN_TIMER_WAIT BIGINT unsigned not null,"
1828 "AVG_TIMER_WAIT BIGINT unsigned not null,"
1829 "MAX_TIMER_WAIT BIGINT unsigned not null,"
1830 "COUNT_READ_WRITE BIGINT unsigned not null,"
1831 "SUM_TIMER_READ_WRITE BIGINT unsigned not null,"
1832 "MIN_TIMER_READ_WRITE BIGINT unsigned not null,"
1833 "AVG_TIMER_READ_WRITE BIGINT unsigned not null,"
1834 "MAX_TIMER_READ_WRITE BIGINT unsigned not null,"
1835 "COUNT_READ_ONLY BIGINT unsigned not null,"
1836 "SUM_TIMER_READ_ONLY BIGINT unsigned not null,"
1837 "MIN_TIMER_READ_ONLY BIGINT unsigned not null,"
1838 "AVG_TIMER_READ_ONLY BIGINT unsigned not null,"
1839 "MAX_TIMER_READ_ONLY BIGINT unsigned not null"
1840 ")ENGINE=PERFORMANCE_SCHEMA;";
1841
1842SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1843PREPARE stmt FROM @str;
1844EXECUTE stmt;
1845DROP PREPARE stmt;
1846
1847--
1848-- TABLE EVENTS_TRANSACTIONS_SUMMARY_GLOBAL_BY_EVENT_NAME
1849--
1850
1851SET @cmd="CREATE TABLE performance_schema.events_transactions_summary_global_by_event_name("
1852 "EVENT_NAME VARCHAR(128) not null,"
1853 "COUNT_STAR BIGINT unsigned not null,"
1854 "SUM_TIMER_WAIT BIGINT unsigned not null,"
1855 "MIN_TIMER_WAIT BIGINT unsigned not null,"
1856 "AVG_TIMER_WAIT BIGINT unsigned not null,"
1857 "MAX_TIMER_WAIT BIGINT unsigned not null,"
1858 "COUNT_READ_WRITE BIGINT unsigned not null,"
1859 "SUM_TIMER_READ_WRITE BIGINT unsigned not null,"
1860 "MIN_TIMER_READ_WRITE BIGINT unsigned not null,"
1861 "AVG_TIMER_READ_WRITE BIGINT unsigned not null,"
1862 "MAX_TIMER_READ_WRITE BIGINT unsigned not null,"
1863 "COUNT_READ_ONLY BIGINT unsigned not null,"
1864 "SUM_TIMER_READ_ONLY BIGINT unsigned not null,"
1865 "MIN_TIMER_READ_ONLY BIGINT unsigned not null,"
1866 "AVG_TIMER_READ_ONLY BIGINT unsigned not null,"
1867 "MAX_TIMER_READ_ONLY BIGINT unsigned not null"
1868 ")ENGINE=PERFORMANCE_SCHEMA;";
1869
1870SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1871PREPARE stmt FROM @str;
1872EXECUTE stmt;
1873DROP PREPARE stmt;
1874
1875--
1876-- TABLE HOSTS
1877--
1878
1879SET @cmd="CREATE TABLE performance_schema.hosts("
1880 "HOST CHAR(60) collate utf8_bin default null,"
1881 "CURRENT_CONNECTIONS bigint not null,"
1882 "TOTAL_CONNECTIONS bigint not null"
1883 ")ENGINE=PERFORMANCE_SCHEMA;";
1884
1885SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1886PREPARE stmt FROM @str;
1887EXECUTE stmt;
1888DROP PREPARE stmt;
1889
1890--
1891-- TABLE USERS
1892--
1893
1894SET @cmd="CREATE TABLE performance_schema.users("
1895 "USER CHAR(16) collate utf8_bin default null,"
1896 "CURRENT_CONNECTIONS bigint not null,"
1897 "TOTAL_CONNECTIONS bigint not null"
1898 ")ENGINE=PERFORMANCE_SCHEMA;";
1899
1900SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1901PREPARE stmt FROM @str;
1902EXECUTE stmt;
1903DROP PREPARE stmt;
1904
1905--
1906-- TABLE ACCOUNTS
1907--
1908
1909SET @cmd="CREATE TABLE performance_schema.accounts("
1910 "USER CHAR(16) collate utf8_bin default null,"
1911 "HOST CHAR(60) collate utf8_bin default null,"
1912 "CURRENT_CONNECTIONS bigint not null,"
1913 "TOTAL_CONNECTIONS bigint not null"
1914 ")ENGINE=PERFORMANCE_SCHEMA;";
1915
1916SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1917PREPARE stmt FROM @str;
1918EXECUTE stmt;
1919DROP PREPARE stmt;
1920
1921--
1922-- TABLE MEMORY_SUMMARY_GLOBAL_BY_EVENT_NAME
1923--
1924
1925SET @cmd="CREATE TABLE performance_schema.memory_summary_global_by_event_name("
1926 "EVENT_NAME VARCHAR(128) not null,"
1927 "COUNT_ALLOC BIGINT unsigned not null,"
1928 "COUNT_FREE BIGINT unsigned not null,"
1929 "SUM_NUMBER_OF_BYTES_ALLOC BIGINT unsigned not null,"
1930 "SUM_NUMBER_OF_BYTES_FREE BIGINT unsigned not null,"
1931 "LOW_COUNT_USED BIGINT not null,"
1932 "CURRENT_COUNT_USED BIGINT not null,"
1933 "HIGH_COUNT_USED BIGINT not null,"
1934 "LOW_NUMBER_OF_BYTES_USED BIGINT not null,"
1935 "CURRENT_NUMBER_OF_BYTES_USED BIGINT not null,"
1936 "HIGH_NUMBER_OF_BYTES_USED BIGINT not null"
1937 ")ENGINE=PERFORMANCE_SCHEMA;";
1938
1939SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1940PREPARE stmt FROM @str;
1941EXECUTE stmt;
1942DROP PREPARE stmt;
1943
1944--
1945-- TABLE MEMORY_SUMMARY_BY_THREAD_BY_EVENT_NAME
1946--
1947
1948SET @cmd="CREATE TABLE performance_schema.memory_summary_by_thread_by_event_name("
1949 "THREAD_ID BIGINT unsigned not null,"
1950 "EVENT_NAME VARCHAR(128) not null,"
1951 "COUNT_ALLOC BIGINT unsigned not null,"
1952 "COUNT_FREE BIGINT unsigned not null,"
1953 "SUM_NUMBER_OF_BYTES_ALLOC BIGINT unsigned not null,"
1954 "SUM_NUMBER_OF_BYTES_FREE BIGINT unsigned not null,"
1955 "LOW_COUNT_USED BIGINT not null,"
1956 "CURRENT_COUNT_USED BIGINT not null,"
1957 "HIGH_COUNT_USED BIGINT not null,"
1958 "LOW_NUMBER_OF_BYTES_USED BIGINT not null,"
1959 "CURRENT_NUMBER_OF_BYTES_USED BIGINT not null,"
1960 "HIGH_NUMBER_OF_BYTES_USED BIGINT not null"
1961 ")ENGINE=PERFORMANCE_SCHEMA;";
1962
1963SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1964PREPARE stmt FROM @str;
1965EXECUTE stmt;
1966DROP PREPARE stmt;
1967
1968--
1969-- TABLE MEMORY_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME
1970--
1971
1972SET @cmd="CREATE TABLE performance_schema.memory_summary_by_account_by_event_name("
1973 "USER CHAR(16) collate utf8_bin default null,"
1974 "HOST CHAR(60) collate utf8_bin default null,"
1975 "EVENT_NAME VARCHAR(128) not null,"
1976 "COUNT_ALLOC BIGINT unsigned not null,"
1977 "COUNT_FREE BIGINT unsigned not null,"
1978 "SUM_NUMBER_OF_BYTES_ALLOC BIGINT unsigned not null,"
1979 "SUM_NUMBER_OF_BYTES_FREE BIGINT unsigned not null,"
1980 "LOW_COUNT_USED BIGINT not null,"
1981 "CURRENT_COUNT_USED BIGINT not null,"
1982 "HIGH_COUNT_USED BIGINT not null,"
1983 "LOW_NUMBER_OF_BYTES_USED BIGINT not null,"
1984 "CURRENT_NUMBER_OF_BYTES_USED BIGINT not null,"
1985 "HIGH_NUMBER_OF_BYTES_USED BIGINT not null"
1986 ")ENGINE=PERFORMANCE_SCHEMA;";
1987
1988SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
1989PREPARE stmt FROM @str;
1990EXECUTE stmt;
1991DROP PREPARE stmt;
1992
1993--
1994-- TABLE MEMORY_SUMMARY_BY_HOST_BY_EVENT_NAME
1995--
1996
1997SET @cmd="CREATE TABLE performance_schema.memory_summary_by_host_by_event_name("
1998 "HOST CHAR(60) collate utf8_bin default null,"
1999 "EVENT_NAME VARCHAR(128) not null,"
2000 "COUNT_ALLOC BIGINT unsigned not null,"
2001 "COUNT_FREE BIGINT unsigned not null,"
2002 "SUM_NUMBER_OF_BYTES_ALLOC BIGINT unsigned not null,"
2003 "SUM_NUMBER_OF_BYTES_FREE BIGINT unsigned not null,"
2004 "LOW_COUNT_USED BIGINT not null,"
2005 "CURRENT_COUNT_USED BIGINT not null,"
2006 "HIGH_COUNT_USED BIGINT not null,"
2007 "LOW_NUMBER_OF_BYTES_USED BIGINT not null,"
2008 "CURRENT_NUMBER_OF_BYTES_USED BIGINT not null,"
2009 "HIGH_NUMBER_OF_BYTES_USED BIGINT not null"
2010 ")ENGINE=PERFORMANCE_SCHEMA;";
2011
2012SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
2013PREPARE stmt FROM @str;
2014EXECUTE stmt;
2015DROP PREPARE stmt;
2016
2017--
2018-- TABLE MEMORY_SUMMARY_BY_USER_BY_EVENT_NAME
2019--
2020
2021SET @cmd="CREATE TABLE performance_schema.memory_summary_by_user_by_event_name("
2022 "USER CHAR(16) collate utf8_bin default null,"
2023 "EVENT_NAME VARCHAR(128) not null,"
2024 "COUNT_ALLOC BIGINT unsigned not null,"
2025 "COUNT_FREE BIGINT unsigned not null,"
2026 "SUM_NUMBER_OF_BYTES_ALLOC BIGINT unsigned not null,"
2027 "SUM_NUMBER_OF_BYTES_FREE BIGINT unsigned not null,"
2028 "LOW_COUNT_USED BIGINT not null,"
2029 "CURRENT_COUNT_USED BIGINT not null,"
2030 "HIGH_COUNT_USED BIGINT not null,"
2031 "LOW_NUMBER_OF_BYTES_USED BIGINT not null,"
2032 "CURRENT_NUMBER_OF_BYTES_USED BIGINT not null,"
2033 "HIGH_NUMBER_OF_BYTES_USED BIGINT not null"
2034 ")ENGINE=PERFORMANCE_SCHEMA;";
2035
2036SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
2037PREPARE stmt FROM @str;
2038EXECUTE stmt;
2039DROP PREPARE stmt;
2040
2041--
2042-- TABLE EVENTS_STATEMENTS_SUMMARY_BY_DIGEST
2043--
2044
2045SET @cmd="CREATE TABLE performance_schema.events_statements_summary_by_digest("
2046 "SCHEMA_NAME VARCHAR(64),"
2047 "DIGEST VARCHAR(32),"
2048 "DIGEST_TEXT LONGTEXT,"
2049 "COUNT_STAR BIGINT unsigned not null,"
2050 "SUM_TIMER_WAIT BIGINT unsigned not null,"
2051 "MIN_TIMER_WAIT BIGINT unsigned not null,"
2052 "AVG_TIMER_WAIT BIGINT unsigned not null,"
2053 "MAX_TIMER_WAIT BIGINT unsigned not null,"
2054 "SUM_LOCK_TIME BIGINT unsigned not null,"
2055 "SUM_ERRORS BIGINT unsigned not null,"
2056 "SUM_WARNINGS BIGINT unsigned not null,"
2057 "SUM_ROWS_AFFECTED BIGINT unsigned not null,"
2058 "SUM_ROWS_SENT BIGINT unsigned not null,"
2059 "SUM_ROWS_EXAMINED BIGINT unsigned not null,"
2060 "SUM_CREATED_TMP_DISK_TABLES BIGINT unsigned not null,"
2061 "SUM_CREATED_TMP_TABLES BIGINT unsigned not null,"
2062 "SUM_SELECT_FULL_JOIN BIGINT unsigned not null,"
2063 "SUM_SELECT_FULL_RANGE_JOIN BIGINT unsigned not null,"
2064 "SUM_SELECT_RANGE BIGINT unsigned not null,"
2065 "SUM_SELECT_RANGE_CHECK BIGINT unsigned not null,"
2066 "SUM_SELECT_SCAN BIGINT unsigned not null,"
2067 "SUM_SORT_MERGE_PASSES BIGINT unsigned not null,"
2068 "SUM_SORT_RANGE BIGINT unsigned not null,"
2069 "SUM_SORT_ROWS BIGINT unsigned not null,"
2070 "SUM_SORT_SCAN BIGINT unsigned not null,"
2071 "SUM_NO_INDEX_USED BIGINT unsigned not null,"
2072 "SUM_NO_GOOD_INDEX_USED BIGINT unsigned not null,"
2073 "FIRST_SEEN TIMESTAMP(0) NOT NULL default 0,"
2074 "LAST_SEEN TIMESTAMP(0) NOT NULL default 0"
2075 ")ENGINE=PERFORMANCE_SCHEMA;";
2076
2077
2078SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
2079PREPARE stmt FROM @str;
2080EXECUTE stmt;
2081DROP PREPARE stmt;
2082
2083--
2084-- TABLE EVENTS_STATEMENTS_SUMMARY_BY_PROGRAM
2085--
2086
2087SET @cmd="CREATE TABLE performance_schema.events_statements_summary_by_program("
2088 "OBJECT_TYPE enum('EVENT', 'FUNCTION', 'PROCEDURE', 'TABLE', 'TRIGGER'),"
2089 "OBJECT_SCHEMA varchar(64) NOT NULL,"
2090 "OBJECT_NAME varchar(64) NOT NULL,"
2091 "COUNT_STAR bigint(20) unsigned NOT NULL,"
2092 "SUM_TIMER_WAIT bigint(20) unsigned NOT NULL,"
2093 "MIN_TIMER_WAIT bigint(20) unsigned NOT NULL,"
2094 "AVG_TIMER_WAIT bigint(20) unsigned NOT NULL,"
2095 "MAX_TIMER_WAIT bigint(20) unsigned NOT NULL,"
2096 "COUNT_STATEMENTS bigint(20) unsigned NOT NULL,"
2097 "SUM_STATEMENTS_WAIT bigint(20) unsigned NOT NULL,"
2098 "MIN_STATEMENTS_WAIT bigint(20) unsigned NOT NULL,"
2099 "AVG_STATEMENTS_WAIT bigint(20) unsigned NOT NULL,"
2100 "MAX_STATEMENTS_WAIT bigint(20) unsigned NOT NULL,"
2101 "SUM_LOCK_TIME bigint(20) unsigned NOT NULL,"
2102 "SUM_ERRORS bigint(20) unsigned NOT NULL,"
2103 "SUM_WARNINGS bigint(20) unsigned NOT NULL,"
2104 "SUM_ROWS_AFFECTED bigint(20) unsigned NOT NULL,"
2105 "SUM_ROWS_SENT bigint(20) unsigned NOT NULL,"
2106 "SUM_ROWS_EXAMINED bigint(20) unsigned NOT NULL,"
2107 "SUM_CREATED_TMP_DISK_TABLES bigint(20) unsigned NOT NULL,"
2108 "SUM_CREATED_TMP_TABLES bigint(20) unsigned NOT NULL,"
2109 "SUM_SELECT_FULL_JOIN bigint(20) unsigned NOT NULL,"
2110 "SUM_SELECT_FULL_RANGE_JOIN bigint(20) unsigned NOT NULL,"
2111 "SUM_SELECT_RANGE bigint(20) unsigned NOT NULL,"
2112 "SUM_SELECT_RANGE_CHECK bigint(20) unsigned NOT NULL,"
2113 "SUM_SELECT_SCAN bigint(20) unsigned NOT NULL,"
2114 "SUM_SORT_MERGE_PASSES bigint(20) unsigned NOT NULL,"
2115 "SUM_SORT_RANGE bigint(20) unsigned NOT NULL,"
2116 "SUM_SORT_ROWS bigint(20) unsigned NOT NULL,"
2117 "SUM_SORT_SCAN bigint(20) unsigned NOT NULL,"
2118 "SUM_NO_INDEX_USED bigint(20) unsigned NOT NULL,"
2119 "SUM_NO_GOOD_INDEX_USED bigint(20) unsigned NOT NULL"
2120 ")ENGINE=PERFORMANCE_SCHEMA;";
2121
2122SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
2123PREPARE stmt FROM @str;
2124EXECUTE stmt;
2125DROP PREPARE stmt;
2126
2127--
2128-- TABLE PREPARED_STATEMENT_INSTANCES
2129--
2130
2131SET @cmd="CREATE TABLE performance_schema.prepared_statements_instances("
2132 "OBJECT_INSTANCE_BEGIN bigint(20) unsigned NOT NULL,"
2133 "STATEMENT_ID bigint(20) unsigned NOT NULL,"
2134 "STATEMENT_NAME varchar(64) default NULL,"
2135 "SQL_TEXT longtext NOT NULL,"
2136 "OWNER_THREAD_ID bigint(20) unsigned NOT NULL,"
2137 "OWNER_EVENT_ID bigint(20) unsigned NOT NULL,"
2138 "OWNER_OBJECT_TYPE enum('EVENT','FUNCTION','PROCEDURE','TABLE','TRIGGER') DEFAULT NULL,"
2139 "OWNER_OBJECT_SCHEMA varchar(64) DEFAULT NULL,"
2140 "OWNER_OBJECT_NAME varchar(64) DEFAULT NULL,"
2141 "TIMER_PREPARE bigint(20) unsigned NOT NULL,"
2142 "COUNT_REPREPARE bigint(20) unsigned NOT NULL,"
2143 "COUNT_EXECUTE bigint(20) unsigned NOT NULL,"
2144 "SUM_TIMER_EXECUTE bigint(20) unsigned NOT NULL,"
2145 "MIN_TIMER_EXECUTE bigint(20) unsigned NOT NULL,"
2146 "AVG_TIMER_EXECUTE bigint(20) unsigned NOT NULL,"
2147 "MAX_TIMER_EXECUTE bigint(20) unsigned NOT NULL,"
2148 "SUM_LOCK_TIME bigint(20) unsigned NOT NULL,"
2149 "SUM_ERRORS bigint(20) unsigned NOT NULL,"
2150 "SUM_WARNINGS bigint(20) unsigned NOT NULL,"
2151 "SUM_ROWS_AFFECTED bigint(20) unsigned NOT NULL,"
2152 "SUM_ROWS_SENT bigint(20) unsigned NOT NULL,"
2153 "SUM_ROWS_EXAMINED bigint(20) unsigned NOT NULL,"
2154 "SUM_CREATED_TMP_DISK_TABLES bigint(20) unsigned NOT NULL,"
2155 "SUM_CREATED_TMP_TABLES bigint(20) unsigned NOT NULL,"
2156 "SUM_SELECT_FULL_JOIN bigint(20) unsigned NOT NULL,"
2157 "SUM_SELECT_FULL_RANGE_JOIN bigint(20) unsigned NOT NULL,"
2158 "SUM_SELECT_RANGE bigint(20) unsigned NOT NULL,"
2159 "SUM_SELECT_RANGE_CHECK bigint(20) unsigned NOT NULL,"
2160 "SUM_SELECT_SCAN bigint(20) unsigned NOT NULL,"
2161 "SUM_SORT_MERGE_PASSES bigint(20) unsigned NOT NULL,"
2162 "SUM_SORT_RANGE bigint(20) unsigned NOT NULL,"
2163 "SUM_SORT_ROWS bigint(20) unsigned NOT NULL,"
2164 "SUM_SORT_SCAN bigint(20) unsigned NOT NULL,"
2165 "SUM_NO_INDEX_USED bigint(20) unsigned NOT NULL,"
2166 "SUM_NO_GOOD_INDEX_USED bigint(20) unsigned NOT NULL"
2167 ")ENGINE=PERFORMANCE_SCHEMA;";
2168
2169SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
2170PREPARE stmt FROM @str;
2171EXECUTE stmt;
2172DROP PREPARE stmt;
2173
2174--
2175-- TABLE replication_connection_configuration
2176--
2177
2178SET @cmd="CREATE TABLE performance_schema.replication_connection_configuration("
2179 "HOST CHAR(60) collate utf8_bin not null,"
2180 "PORT INTEGER not null,"
2181 "USER CHAR(16) collate utf8_bin not null,"
2182 "NETWORK_INTERFACE CHAR(60) collate utf8_bin not null,"
2183 "AUTO_POSITION ENUM('1','0') not null,"
2184 "SSL_ALLOWED ENUM('YES','NO','IGNORED') not null,"
2185 "SSL_CA_FILE VARCHAR(512) not null,"
2186 "SSL_CA_PATH VARCHAR(512) not null,"
2187 "SSL_CERTIFICATE VARCHAR(512) not null,"
2188 "SSL_CIPHER VARCHAR(512) not null,"
2189 "SSL_KEY VARCHAR(512) not null,"
2190 "SSL_VERIFY_SERVER_CERTIFICATE ENUM('YES','NO') not null,"
2191 "SSL_CRL_FILE VARCHAR(255) not null,"
2192 "SSL_CRL_PATH VARCHAR(255) not null,"
2193 "CONNECTION_RETRY_INTERVAL INTEGER not null,"
2194 "CONNECTION_RETRY_COUNT BIGINT unsigned not null,"
2195 "HEARTBEAT_INTERVAL DOUBLE(10,3) unsigned not null COMMENT 'Number of seconds after which a heartbeat will be sent .'"
2196 ") ENGINE=PERFORMANCE_SCHEMA;";
2197
2198SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
2199PREPARE stmt FROM @str;
2200EXECUTE stmt;
2201DROP PREPARE stmt;
2202
2203--
2204-- TABLE replication_connection_status
2205--
2206
2207SET @cmd="CREATE TABLE performance_schema.replication_connection_status("
2208 "SOURCE_UUID CHAR(36) collate utf8_bin not null,"
2209 "THREAD_ID BIGINT unsigned,"
2210 "SERVICE_STATE ENUM('ON','OFF','CONNECTING') not null,"
2211 "COUNT_RECEIVED_HEARTBEATS bigint unsigned NOT NULL DEFAULT 0,"
2212 "LAST_HEARTBEAT_TIMESTAMP TIMESTAMP(0) not null COMMENT 'Shows when the most recent heartbeat signal was received.',"
2213 "RECEIVED_TRANSACTION_SET TEXT not null,"
2214 "LAST_ERROR_NUMBER INTEGER not null,"
2215 "LAST_ERROR_MESSAGE VARCHAR(1024) not null,"
2216 "LAST_ERROR_TIMESTAMP TIMESTAMP(0) not null"
2217 ") ENGINE=PERFORMANCE_SCHEMA;";
2218
2219SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
2220PREPARE stmt FROM @str;
2221EXECUTE stmt;
2222DROP PREPARE stmt;
2223
2224--
2225-- TABLE replication_execute_configuration
2226--
2227
2228SET @cmd="CREATE TABLE performance_schema.replication_execute_configuration("
2229 "DESIRED_DELAY INTEGER not null"
2230 ") ENGINE=PERFORMANCE_SCHEMA;";
2231
2232SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
2233PREPARE stmt FROM @str;
2234EXECUTE stmt;
2235DROP PREPARE stmt;
2236
2237--
2238-- TABLE replication_execute_status
2239--
2240
2241SET @cmd="CREATE TABLE performance_schema.replication_execute_status("
2242 "SERVICE_STATE ENUM('ON','OFF') not null,"
2243 "REMAINING_DELAY INTEGER unsigned,"
2244 "COUNT_TRANSACTIONS_RETRIES BIGINT unsigned not null"
2245 ") ENGINE=PERFORMANCE_SCHEMA;";
2246
2247SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
2248PREPARE stmt FROM @str;
2249EXECUTE stmt;
2250DROP PREPARE stmt;
2251
2252--
2253-- TABLE replication_execute_status_by_coordinator
2254--
2255
2256SET @cmd="CREATE TABLE performance_schema.replication_execute_status_by_coordinator("
2257 "THREAD_ID BIGINT UNSIGNED,"
2258 "SERVICE_STATE ENUM('ON','OFF') not null,"
2259 "LAST_ERROR_NUMBER INTEGER not null,"
2260 "LAST_ERROR_MESSAGE VARCHAR(1024) not null,"
2261 "LAST_ERROR_TIMESTAMP TIMESTAMP(0) not null"
2262 ") ENGINE=PERFORMANCE_SCHEMA;";
2263
2264SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
2265PREPARE stmt FROM @str;
2266EXECUTE stmt;
2267DROP PREPARE stmt;
2268
2269--
2270-- TABLE replication_execute_status_by_worker
2271--
2272
2273SET @cmd="CREATE TABLE performance_schema.replication_execute_status_by_worker("
2274 "WORKER_ID BIGINT UNSIGNED not null,"
2275 "THREAD_ID BIGINT UNSIGNED,"
2276 "SERVICE_STATE ENUM('ON','OFF') not null,"
2277 "LAST_SEEN_TRANSACTION CHAR(57) not null,"
2278 "LAST_ERROR_NUMBER INTEGER not null,"
2279 "LAST_ERROR_MESSAGE VARCHAR(1024) not null,"
2280 "LAST_ERROR_TIMESTAMP TIMESTAMP(0) not null"
2281 ") ENGINE=PERFORMANCE_SCHEMA;";
2282
2283SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
2284PREPARE stmt FROM @str;
2285EXECUTE stmt;
2286DROP PREPARE stmt;
2287
2288--
2289-- TABLE SESSION_CONNECT_ATTRS
2290--
2291
2292SET @cmd="CREATE TABLE performance_schema.session_connect_attrs("
2293 "PROCESSLIST_ID INT NOT NULL,"
2294 "ATTR_NAME VARCHAR(32) NOT NULL,"
2295 "ATTR_VALUE VARCHAR(1024),"
2296 "ORDINAL_POSITION INT"
2297 ")ENGINE=PERFORMANCE_SCHEMA CHARACTER SET utf8 COLLATE utf8_bin;";
2298
2299SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
2300PREPARE stmt FROM @str;
2301EXECUTE stmt;
2302DROP PREPARE stmt;
2303
2304--
2305-- TABLE SESSION_ACCOUNT_CONNECT_ATTRS
2306--
2307
2308SET @cmd="CREATE TABLE performance_schema.session_account_connect_attrs "
2309 " LIKE performance_schema.session_connect_attrs;";
2310
2311SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
2312PREPARE stmt FROM @str;
2313EXECUTE stmt;
2314DROP PREPARE stmt;
2315
2316--
2317-- TABLE TABLE_HANDLES
2318--
2319
2320SET @cmd="CREATE TABLE performance_schema.table_handles("
2321 "OBJECT_TYPE VARCHAR(64) not null,"
2322 "OBJECT_SCHEMA VARCHAR(64) not null,"
2323 "OBJECT_NAME VARCHAR(64) not null,"
2324 "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
2325 "OWNER_THREAD_ID BIGINT unsigned,"
2326 "OWNER_EVENT_ID BIGINT unsigned,"
2327 "INTERNAL_LOCK VARCHAR(64),"
2328 "EXTERNAL_LOCK VARCHAR(64)"
2329 ")ENGINE=PERFORMANCE_SCHEMA;";
2330
2331SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
2332PREPARE stmt FROM @str;
2333EXECUTE stmt;
2334DROP PREPARE stmt;
2335
2336--
2337-- TABLE METADATA_LOCKS
2338--
2339
2340SET @cmd="CREATE TABLE performance_schema.metadata_locks("
2341 "OBJECT_TYPE VARCHAR(64) not null,"
2342 "OBJECT_SCHEMA VARCHAR(64),"
2343 "OBJECT_NAME VARCHAR(64),"
2344 "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
2345 "LOCK_TYPE VARCHAR(32) not null,"
2346 "LOCK_DURATION VARCHAR(32) not null,"
2347 "LOCK_STATUS VARCHAR(32) not null,"
2348 "SOURCE VARCHAR(64),"
2349 "OWNER_THREAD_ID BIGINT unsigned,"
2350 "OWNER_EVENT_ID BIGINT unsigned"
2351 ")ENGINE=PERFORMANCE_SCHEMA;";
2352
2353SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
2354PREPARE stmt FROM @str;
2355EXECUTE stmt;
2356DROP PREPARE stmt;
2357
2358--
2359-- TABLE USER_VARIABLES_BY_THREAD
2360--
2361
2362SET @cmd="CREATE TABLE performance_schema.user_variables_by_thread("
2363 "THREAD_ID BIGINT unsigned not null,"
2364 "VARIABLE_NAME VARCHAR(64) not null,"
2365 "VARIABLE_VALUE LONGBLOB"
2366 ")ENGINE=PERFORMANCE_SCHEMA;";
2367
2368SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
2369PREPARE stmt FROM @str;
2370EXECUTE stmt;
2371DROP PREPARE stmt;
2372
2373
2374CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(16) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges';
2375
2376-- Remember for later if proxies_priv table already existed
2377set @had_proxies_priv_table= @@warning_count != 0;
2378
2379#
2380# SQL commands for creating the tables in MySQL Server which
2381# are used by the NDBINFO storage engine to access system
2382# information and statistics from MySQL Cluster
2383#
2384# Only create objects if NDBINFO is supported
2385SELECT @have_ndbinfo:= COUNT(*) FROM information_schema.engines WHERE engine='NDBINFO' AND support IN ('YES', 'DEFAULT');
2386
2387# Only create objects if version >= 7.1
2388SET @str=IF(@have_ndbinfo,'SELECT @have_ndbinfo:= (@@ndbinfo_version >= (7 << 16) | (1 << 8)) || @ndbinfo_skip_version_check','SET @dummy = 0');
2389PREPARE stmt FROM @str;
2390EXECUTE stmt;
2391DROP PREPARE stmt;
2392
2393# Only create objects if ndbinfo namespace is free
2394SET @str=IF(@have_ndbinfo,'SET @@ndbinfo_show_hidden=TRUE','SET @dummy = 0');
2395PREPARE stmt FROM @str;
2396EXECUTE stmt;
2397DROP PREPARE stmt;
2398
2399SET @str=IF(@have_ndbinfo,'SELECT @have_ndbinfo:= COUNT(*) = 0 FROM information_schema.tables WHERE table_schema = @@ndbinfo_database AND LEFT(table_name, LENGTH(@@ndbinfo_table_prefix)) = @@ndbinfo_table_prefix AND engine != "ndbinfo"','SET @dummy = 0');
2400PREPARE stmt FROM @str;
2401EXECUTE stmt;
2402DROP PREPARE stmt;
2403
2404SET @str=IF(@have_ndbinfo,'SET @@ndbinfo_show_hidden=default','SET @dummy = 0');
2405PREPARE stmt FROM @str;
2406EXECUTE stmt;
2407DROP PREPARE stmt;
2408
2409SET @str=IF(@have_ndbinfo,'CREATE DATABASE IF NOT EXISTS `ndbinfo`','SET @dummy = 0');
2410PREPARE stmt FROM @str;
2411EXECUTE stmt;
2412DROP PREPARE stmt;
2413
2414# Set NDBINFO in offline mode during (re)create of tables
2415# and views to avoid errors caused by no such table or
2416# different table definition in NDB
2417SET @str=IF(@have_ndbinfo,'SET @@global.ndbinfo_offline=TRUE','SET @dummy = 0');
2418PREPARE stmt FROM @str;
2419EXECUTE stmt;
2420DROP PREPARE stmt;
2421
2422# Drop any old views in ndbinfo
2423SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`transporters`','SET @dummy = 0');
2424PREPARE stmt FROM @str;
2425EXECUTE stmt;
2426DROP PREPARE stmt;
2427
2428SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`logspaces`','SET @dummy = 0');
2429PREPARE stmt FROM @str;
2430EXECUTE stmt;
2431DROP PREPARE stmt;
2432
2433SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`logbuffers`','SET @dummy = 0');
2434PREPARE stmt FROM @str;
2435EXECUTE stmt;
2436DROP PREPARE stmt;
2437
2438SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`resources`','SET @dummy = 0');
2439PREPARE stmt FROM @str;
2440EXECUTE stmt;
2441DROP PREPARE stmt;
2442
2443SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`counters`','SET @dummy = 0');
2444PREPARE stmt FROM @str;
2445EXECUTE stmt;
2446DROP PREPARE stmt;
2447
2448SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`nodes`','SET @dummy = 0');
2449PREPARE stmt FROM @str;
2450EXECUTE stmt;
2451DROP PREPARE stmt;
2452
2453SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`memoryusage`','SET @dummy = 0');
2454PREPARE stmt FROM @str;
2455EXECUTE stmt;
2456DROP PREPARE stmt;
2457
2458SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`diskpagebuffer`','SET @dummy = 0');
2459PREPARE stmt FROM @str;
2460EXECUTE stmt;
2461DROP PREPARE stmt;
2462
2463SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`diskpagebuffer`','SET @dummy = 0');
2464PREPARE stmt FROM @str;
2465EXECUTE stmt;
2466DROP PREPARE stmt;
2467
2468SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`threadblocks`','SET @dummy = 0');
2469PREPARE stmt FROM @str;
2470EXECUTE stmt;
2471DROP PREPARE stmt;
2472
2473SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`threadstat`','SET @dummy = 0');
2474PREPARE stmt FROM @str;
2475EXECUTE stmt;
2476DROP PREPARE stmt;
2477
2478SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`cluster_transactions`','SET @dummy = 0');
2479PREPARE stmt FROM @str;
2480EXECUTE stmt;
2481DROP PREPARE stmt;
2482
2483SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`server_transactions`','SET @dummy = 0');
2484PREPARE stmt FROM @str;
2485EXECUTE stmt;
2486DROP PREPARE stmt;
2487
2488SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`cluster_operations`','SET @dummy = 0');
2489PREPARE stmt FROM @str;
2490EXECUTE stmt;
2491DROP PREPARE stmt;
2492
2493SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`server_operations`','SET @dummy = 0');
2494PREPARE stmt FROM @str;
2495EXECUTE stmt;
2496DROP PREPARE stmt;
2497
2498SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`membership`','SET @dummy = 0');
2499PREPARE stmt FROM @str;
2500EXECUTE stmt;
2501DROP PREPARE stmt;
2502
2503SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`arbitrator_validity_detail`','SET @dummy = 0');
2504PREPARE stmt FROM @str;
2505EXECUTE stmt;
2506DROP PREPARE stmt;
2507
2508SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`arbitrator_validity_summary`','SET @dummy = 0');
2509PREPARE stmt FROM @str;
2510EXECUTE stmt;
2511DROP PREPARE stmt;
2512
2513SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`memory_per_fragment`','SET @dummy = 0');
2514PREPARE stmt FROM @str;
2515EXECUTE stmt;
2516DROP PREPARE stmt;
2517
2518# Drop any old lookup tables in ndbinfo
2519SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`blocks`','SET @dummy = 0');
2520PREPARE stmt FROM @str;
2521EXECUTE stmt;
2522DROP PREPARE stmt;
2523
2524SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`dict_obj_types`','SET @dummy = 0');
2525PREPARE stmt FROM @str;
2526EXECUTE stmt;
2527DROP PREPARE stmt;
2528
2529SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`config_params`','SET @dummy = 0');
2530PREPARE stmt FROM @str;
2531EXECUTE stmt;
2532DROP PREPARE stmt;
2533
2534SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$dbtc_apiconnect_state`','SET @dummy = 0');
2535PREPARE stmt FROM @str;
2536EXECUTE stmt;
2537DROP PREPARE stmt;
2538
2539SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$dblqh_tcconnect_state`','SET @dummy = 0');
2540PREPARE stmt FROM @str;
2541EXECUTE stmt;
2542DROP PREPARE stmt;
2543
2544# ndbinfo.ndb$tables
2545SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$tables`','SET @dummy = 0');
2546PREPARE stmt FROM @str;
2547EXECUTE stmt;
2548DROP PREPARE stmt;
2549
2550SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$tables` (`table_id` INT UNSIGNED,`table_name` VARCHAR(512),`comment` VARCHAR(512)) COMMENT="metadata for tables available through ndbinfo" ENGINE=NDBINFO','SET @dummy = 0');
2551PREPARE stmt FROM @str;
2552EXECUTE stmt;
2553DROP PREPARE stmt;
2554
2555# ndbinfo.ndb$columns
2556SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$columns`','SET @dummy = 0');
2557PREPARE stmt FROM @str;
2558EXECUTE stmt;
2559DROP PREPARE stmt;
2560
2561SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$columns` (`table_id` INT UNSIGNED,`column_id` INT UNSIGNED,`column_name` VARCHAR(512),`column_type` INT UNSIGNED,`comment` VARCHAR(512)) COMMENT="metadata for columns available through ndbinfo " ENGINE=NDBINFO','SET @dummy = 0');
2562PREPARE stmt FROM @str;
2563EXECUTE stmt;
2564DROP PREPARE stmt;
2565
2566# ndbinfo.ndb$test
2567SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$test`','SET @dummy = 0');
2568PREPARE stmt FROM @str;
2569EXECUTE stmt;
2570DROP PREPARE stmt;
2571
2572SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$test` (`node_id` INT UNSIGNED,`block_number` INT UNSIGNED,`block_instance` INT UNSIGNED,`counter` INT UNSIGNED,`counter2` BIGINT UNSIGNED) COMMENT="for testing" ENGINE=NDBINFO','SET @dummy = 0');
2573PREPARE stmt FROM @str;
2574EXECUTE stmt;
2575DROP PREPARE stmt;
2576
2577# ndbinfo.ndb$pools
2578SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$pools`','SET @dummy = 0');
2579PREPARE stmt FROM @str;
2580EXECUTE stmt;
2581DROP PREPARE stmt;
2582
2583SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$pools` (`node_id` INT UNSIGNED,`block_number` INT UNSIGNED,`block_instance` INT UNSIGNED,`pool_name` VARCHAR(512),`used` BIGINT UNSIGNED COMMENT "currently in use",`total` BIGINT UNSIGNED COMMENT "total allocated",`high` BIGINT UNSIGNED COMMENT "in use high water mark",`entry_size` BIGINT UNSIGNED COMMENT "size in bytes of each object",`config_param1` INT UNSIGNED COMMENT "config param 1 affecting pool",`config_param2` INT UNSIGNED COMMENT "config param 2 affecting pool",`config_param3` INT UNSIGNED COMMENT "config param 3 affecting pool",`config_param4` INT UNSIGNED COMMENT "config param 4 affecting pool") COMMENT="pool usage" ENGINE=NDBINFO','SET @dummy = 0');
2584PREPARE stmt FROM @str;
2585EXECUTE stmt;
2586DROP PREPARE stmt;
2587
2588# ndbinfo.ndb$transporters
2589SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$transporters`','SET @dummy = 0');
2590PREPARE stmt FROM @str;
2591EXECUTE stmt;
2592DROP PREPARE stmt;
2593
2594SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$transporters` (`node_id` INT UNSIGNED COMMENT "Node id reporting",`remote_node_id` INT UNSIGNED COMMENT "Node id at other end of link",`connection_status` INT UNSIGNED COMMENT "State of inter-node link",`remote_address` VARCHAR(512) COMMENT "Address of remote node",`bytes_sent` BIGINT UNSIGNED COMMENT "Bytes sent to remote node",`bytes_received` BIGINT UNSIGNED COMMENT "Bytes received from remote node",`connect_count` INT UNSIGNED COMMENT "Number of times connected",`overloaded` INT UNSIGNED COMMENT "Is link reporting overload",`overload_count` INT UNSIGNED COMMENT "Number of overload onsets since connect",`slowdown` INT UNSIGNED COMMENT "Is link requesting slowdown",`slowdown_count` INT UNSIGNED COMMENT "Number of slowdown onsets since connect") COMMENT="transporter status" ENGINE=NDBINFO','SET @dummy = 0');
2595PREPARE stmt FROM @str;
2596EXECUTE stmt;
2597DROP PREPARE stmt;
2598
2599# ndbinfo.ndb$logspaces
2600SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$logspaces`','SET @dummy = 0');
2601PREPARE stmt FROM @str;
2602EXECUTE stmt;
2603DROP PREPARE stmt;
2604
2605SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$logspaces` (`node_id` INT UNSIGNED,`log_type` INT UNSIGNED COMMENT "0 = REDO, 1 = DD-UNDO",`log_id` INT UNSIGNED,`log_part` INT UNSIGNED,`total` BIGINT UNSIGNED COMMENT "total allocated",`used` BIGINT UNSIGNED COMMENT "currently in use",`high` BIGINT UNSIGNED COMMENT "in use high water mark") COMMENT="logspace usage" ENGINE=NDBINFO','SET @dummy = 0');
2606PREPARE stmt FROM @str;
2607EXECUTE stmt;
2608DROP PREPARE stmt;
2609
2610# ndbinfo.ndb$logbuffers
2611SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$logbuffers`','SET @dummy = 0');
2612PREPARE stmt FROM @str;
2613EXECUTE stmt;
2614DROP PREPARE stmt;
2615
2616SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$logbuffers` (`node_id` INT UNSIGNED,`log_type` INT UNSIGNED COMMENT "0 = REDO, 1 = DD-UNDO",`log_id` INT UNSIGNED,`log_part` INT UNSIGNED,`total` BIGINT UNSIGNED COMMENT "total allocated",`used` BIGINT UNSIGNED COMMENT "currently in use",`high` BIGINT UNSIGNED COMMENT "in use high water mark") COMMENT="logbuffer usage" ENGINE=NDBINFO','SET @dummy = 0');
2617PREPARE stmt FROM @str;
2618EXECUTE stmt;
2619DROP PREPARE stmt;
2620
2621# ndbinfo.ndb$resources
2622SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$resources`','SET @dummy = 0');
2623PREPARE stmt FROM @str;
2624EXECUTE stmt;
2625DROP PREPARE stmt;
2626
2627SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$resources` (`node_id` INT UNSIGNED,`resource_id` INT UNSIGNED,`reserved` INT UNSIGNED COMMENT "reserved for this resource",`used` INT UNSIGNED COMMENT "currently in use",`max` INT UNSIGNED COMMENT "max available",`high` INT UNSIGNED COMMENT "in use high water mark") COMMENT="resources usage (a.k.a superpool)" ENGINE=NDBINFO','SET @dummy = 0');
2628PREPARE stmt FROM @str;
2629EXECUTE stmt;
2630DROP PREPARE stmt;
2631
2632# ndbinfo.ndb$counters
2633SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$counters`','SET @dummy = 0');
2634PREPARE stmt FROM @str;
2635EXECUTE stmt;
2636DROP PREPARE stmt;
2637
2638SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$counters` (`node_id` INT UNSIGNED,`block_number` INT UNSIGNED,`block_instance` INT UNSIGNED,`counter_id` INT UNSIGNED,`val` BIGINT UNSIGNED COMMENT "monotonically increasing since process start") COMMENT="monotonic counters" ENGINE=NDBINFO','SET @dummy = 0');
2639PREPARE stmt FROM @str;
2640EXECUTE stmt;
2641DROP PREPARE stmt;
2642
2643# ndbinfo.ndb$nodes
2644SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$nodes`','SET @dummy = 0');
2645PREPARE stmt FROM @str;
2646EXECUTE stmt;
2647DROP PREPARE stmt;
2648
2649SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$nodes` (`node_id` INT UNSIGNED,`uptime` BIGINT UNSIGNED COMMENT "time in seconds that node has been running",`status` INT UNSIGNED COMMENT "starting/started/stopped etc.",`start_phase` INT UNSIGNED COMMENT "start phase if node is starting",`config_generation` INT UNSIGNED COMMENT "configuration generation number") COMMENT="node status" ENGINE=NDBINFO','SET @dummy = 0');
2650PREPARE stmt FROM @str;
2651EXECUTE stmt;
2652DROP PREPARE stmt;
2653
2654# ndbinfo.ndb$diskpagebuffer
2655SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$diskpagebuffer`','SET @dummy = 0');
2656PREPARE stmt FROM @str;
2657EXECUTE stmt;
2658DROP PREPARE stmt;
2659
2660SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$diskpagebuffer` (`node_id` INT UNSIGNED,`block_instance` INT UNSIGNED,`pages_written` BIGINT UNSIGNED COMMENT "Pages written to disk",`pages_written_lcp` BIGINT UNSIGNED COMMENT "Pages written by local checkpoint",`pages_read` BIGINT UNSIGNED COMMENT "Pages read from disk",`log_waits` BIGINT UNSIGNED COMMENT "Page writes waiting for log to be written to disk",`page_requests_direct_return` BIGINT UNSIGNED COMMENT "Page in buffer and no requests waiting for it",`page_requests_wait_queue` BIGINT UNSIGNED COMMENT "Page in buffer, but some requests are already waiting for it",`page_requests_wait_io` BIGINT UNSIGNED COMMENT "Page not in buffer, waiting to be read from disk") COMMENT="disk page buffer info" ENGINE=NDBINFO','SET @dummy = 0');
2661PREPARE stmt FROM @str;
2662EXECUTE stmt;
2663DROP PREPARE stmt;
2664
2665# ndbinfo.ndb$threadblocks
2666SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$threadblocks`','SET @dummy = 0');
2667PREPARE stmt FROM @str;
2668EXECUTE stmt;
2669DROP PREPARE stmt;
2670
2671SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$threadblocks` (`node_id` INT UNSIGNED COMMENT "node id",`thr_no` INT UNSIGNED COMMENT "thread number",`block_number` INT UNSIGNED COMMENT "block number",`block_instance` INT UNSIGNED COMMENT "block instance") COMMENT="which blocks are run in which threads" ENGINE=NDBINFO','SET @dummy = 0');
2672PREPARE stmt FROM @str;
2673EXECUTE stmt;
2674DROP PREPARE stmt;
2675
2676# ndbinfo.ndb$threadstat
2677SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$threadstat`','SET @dummy = 0');
2678PREPARE stmt FROM @str;
2679EXECUTE stmt;
2680DROP PREPARE stmt;
2681
2682SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$threadstat` (`node_id` INT UNSIGNED COMMENT "node id",`thr_no` INT UNSIGNED COMMENT "thread number",`thr_nm` VARCHAR(512) COMMENT "thread name",`c_loop` BIGINT UNSIGNED COMMENT "No of loops in main loop",`c_exec` BIGINT UNSIGNED COMMENT "No of signals executed",`c_wait` BIGINT UNSIGNED COMMENT "No of times waited for more input",`c_l_sent_prioa` BIGINT UNSIGNED COMMENT "No of prio A signals sent to own node",`c_l_sent_priob` BIGINT UNSIGNED COMMENT "No of prio B signals sent to own node",`c_r_sent_prioa` BIGINT UNSIGNED COMMENT "No of prio A signals sent to remote node",`c_r_sent_priob` BIGINT UNSIGNED COMMENT "No of prio B signals sent to remote node",`os_tid` BIGINT UNSIGNED COMMENT "OS thread id",`os_now` BIGINT UNSIGNED COMMENT "OS gettimeofday (millis)",`os_ru_utime` BIGINT UNSIGNED COMMENT "OS user CPU time (micros)",`os_ru_stime` BIGINT UNSIGNED COMMENT "OS system CPU time (micros)",`os_ru_minflt` BIGINT UNSIGNED COMMENT "OS page reclaims (soft page faults",`os_ru_majflt` BIGINT UNSIGNED COMMENT "OS page faults (hard page faults)",`os_ru_nvcsw` BIGINT UNSIGNED COMMENT "OS voluntary context switches",`os_ru_nivcsw` BIGINT UNSIGNED COMMENT "OS involuntary context switches") COMMENT="Statistics on execution threads" ENGINE=NDBINFO','SET @dummy = 0');
2683PREPARE stmt FROM @str;
2684EXECUTE stmt;
2685DROP PREPARE stmt;
2686
2687# ndbinfo.ndb$transactions
2688SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$transactions`','SET @dummy = 0');
2689PREPARE stmt FROM @str;
2690EXECUTE stmt;
2691DROP PREPARE stmt;
2692
2693SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$transactions` (`node_id` INT UNSIGNED COMMENT "node id",`block_instance` INT UNSIGNED COMMENT "TC instance no",`objid` INT UNSIGNED COMMENT "Object id of transaction object",`apiref` INT UNSIGNED COMMENT "API reference",`transid0` INT UNSIGNED COMMENT "Transaction id",`transid1` INT UNSIGNED COMMENT "Transaction id",`state` INT UNSIGNED COMMENT "Transaction state",`flags` INT UNSIGNED COMMENT "Transaction flags",`c_ops` INT UNSIGNED COMMENT "No of operations in transaction",`outstanding` INT UNSIGNED COMMENT "Currently outstanding request",`timer` INT UNSIGNED COMMENT "Timer (seconds)") COMMENT="transactions" ENGINE=NDBINFO','SET @dummy = 0');
2694PREPARE stmt FROM @str;
2695EXECUTE stmt;
2696DROP PREPARE stmt;
2697
2698# ndbinfo.ndb$operations
2699SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$operations`','SET @dummy = 0');
2700PREPARE stmt FROM @str;
2701EXECUTE stmt;
2702DROP PREPARE stmt;
2703
2704SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$operations` (`node_id` INT UNSIGNED COMMENT "node id",`block_instance` INT UNSIGNED COMMENT "LQH instance no",`objid` INT UNSIGNED COMMENT "Object id of operation object",`tcref` INT UNSIGNED COMMENT "TC reference",`apiref` INT UNSIGNED COMMENT "API reference",`transid0` INT UNSIGNED COMMENT "Transaction id",`transid1` INT UNSIGNED COMMENT "Transaction id",`tableid` INT UNSIGNED COMMENT "Table id",`fragmentid` INT UNSIGNED COMMENT "Fragment id",`op` INT UNSIGNED COMMENT "Operation type",`state` INT UNSIGNED COMMENT "Operation state",`flags` INT UNSIGNED COMMENT "Operation flags") COMMENT="operations" ENGINE=NDBINFO','SET @dummy = 0');
2705PREPARE stmt FROM @str;
2706EXECUTE stmt;
2707DROP PREPARE stmt;
2708
2709# ndbinfo.ndb$membership
2710SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$membership`','SET @dummy = 0');
2711PREPARE stmt FROM @str;
2712EXECUTE stmt;
2713DROP PREPARE stmt;
2714
2715SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$membership` (`node_id` INT UNSIGNED COMMENT "node id",`group_id` INT UNSIGNED COMMENT "node group id",`left_node` INT UNSIGNED COMMENT "Left node in heart beat chain",`right_node` INT UNSIGNED COMMENT "Right node in heart beat chain",`president` INT UNSIGNED COMMENT "President nodeid",`successor` INT UNSIGNED COMMENT "President successor",`dynamic_id` INT UNSIGNED COMMENT "President, Configured_heartbeat order",`arbitrator` INT UNSIGNED COMMENT "Arbitrator nodeid",`arb_ticket` VARCHAR(512) COMMENT "Arbitrator ticket",`arb_state` INT UNSIGNED COMMENT "Arbitrator state",`arb_connected` INT UNSIGNED COMMENT "Arbitrator connected",`conn_rank1_arbs` VARCHAR(512) COMMENT "Connected rank 1 arbitrators",`conn_rank2_arbs` VARCHAR(512) COMMENT "Connected rank 2 arbitrators") COMMENT="membership" ENGINE=NDBINFO','SET @dummy = 0');
2716PREPARE stmt FROM @str;
2717EXECUTE stmt;
2718DROP PREPARE stmt;
2719
2720# ndbinfo.ndb$frag_mem_use
2721SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$frag_mem_use`','SET @dummy = 0');
2722PREPARE stmt FROM @str;
2723EXECUTE stmt;
2724DROP PREPARE stmt;
2725
2726SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$frag_mem_use` (`node_id` INT UNSIGNED COMMENT "node id",`block_instance` INT UNSIGNED COMMENT "LDM instance number",`table_id` INT UNSIGNED COMMENT "Table identity",`fragment_num` INT UNSIGNED COMMENT "Fragment number",`rows` BIGINT UNSIGNED COMMENT "Number of rows in table",`fixed_elem_alloc_bytes` BIGINT UNSIGNED COMMENT "Number of bytes allocated for fixed-sized elements",`fixed_elem_free_bytes` BIGINT UNSIGNED COMMENT "Free bytes in fixed-size element pages",`fixed_elem_count` BIGINT UNSIGNED COMMENT "Number of fixed size elements in use",`fixed_elem_size_bytes` INT UNSIGNED COMMENT "Length of each fixed sized element in bytes",`var_elem_alloc_bytes` BIGINT UNSIGNED COMMENT "Number of bytes allocated for var-size elements",`var_elem_free_bytes` BIGINT UNSIGNED COMMENT "Free bytes in var-size element pages",`var_elem_count` BIGINT UNSIGNED COMMENT "Number of var size elements in use",`tuple_l2pmap_alloc_bytes` BIGINT UNSIGNED COMMENT "Bytes in logical to physical page map for tuple store",`hash_index_l2pmap_alloc_bytes` BIGINT UNSIGNED COMMENT "Bytes in logical to physical page map for the hash index",`hash_index_alloc_bytes` BIGINT UNSIGNED COMMENT "Bytes in linear hash map") COMMENT="Per fragment space information" ENGINE=NDBINFO','SET @dummy = 0');
2727PREPARE stmt FROM @str;
2728EXECUTE stmt;
2729DROP PREPARE stmt;
2730
2731# ndbinfo.blocks
2732SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`blocks` (block_number INT UNSIGNED PRIMARY KEY, block_name VARCHAR(512))','SET @dummy = 0');
2733PREPARE stmt FROM @str;
2734EXECUTE stmt;
2735DROP PREPARE stmt;
2736
2737SET @str=IF(@have_ndbinfo,'INSERT INTO `ndbinfo`.`blocks` VALUES (254, "CMVMI"), (248, "DBACC"), (250, "DBDICT"), (246, "DBDIH"), (247, "DBLQH"), (245, "DBTC"), (249, "DBTUP"), (253, "NDBFS"), (251, "NDBCNTR"), (252, "QMGR"), (255, "TRIX"), (244, "BACKUP"), (256, "DBUTIL"), (257, "SUMA"), (258, "DBTUX"), (259, "TSMAN"), (260, "LGMAN"), (261, "PGMAN"), (262, "RESTORE"), (263, "DBINFO"), (264, "DBSPJ"), (265, "THRMAN"), (266, "TRPMAN")','SET @dummy = 0');
2738PREPARE stmt FROM @str;
2739EXECUTE stmt;
2740DROP PREPARE stmt;
2741
2742# ndbinfo.ndb$dict_obj_info
2743SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$dict_obj_info`','SET @dummy = 0');
2744PREPARE stmt FROM @str;
2745EXECUTE stmt;
2746DROP PREPARE stmt;
2747
2748SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$dict_obj_info` (`type` INT UNSIGNED COMMENT "Type of dict object",`id` INT UNSIGNED COMMENT "Object identity",`version` INT UNSIGNED COMMENT "Object version",`state` INT UNSIGNED COMMENT "Object state",`parent_obj_type` INT UNSIGNED COMMENT "Parent object type",`parent_obj_id` INT UNSIGNED COMMENT "Parent object id",`fq_name` VARCHAR(512) COMMENT "Fully qualified object name") COMMENT="Dictionary object info" ENGINE=NDBINFO','SET @dummy = 0');
2749PREPARE stmt FROM @str;
2750EXECUTE stmt;
2751DROP PREPARE stmt;
2752
2753# ndbinfo.dict_obj_types
2754SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`dict_obj_types` (`type_id` INT UNSIGNED PRIMARY KEY,`type_name` VARCHAR(512))','SET @dummy = 0');
2755PREPARE stmt FROM @str;
2756EXECUTE stmt;
2757DROP PREPARE stmt;
2758
2759SET @str=IF(@have_ndbinfo,'INSERT INTO `ndbinfo`.`dict_obj_types` VALUES (1, "System table"), (2, "User table"), (3, "Unique hash index"), (4, "Hash index"), (5, "Unique ordered index"), (6, "Ordered index"), (11, "Hash index trigger"), (16, "Subscription trigger"), (17, "Read only constraint"), (18, "Index trigger"), (19, "Reorganize trigger"), (20, "Tablespace"), (21, "Log file group"), (22, "Data file"), (23, "Undo file"), (24, "Hash map"), (25, "Foreign key definition"), (26, "Foreign key parent trigger"), (27, "Foreign key child trigger"), (30, "Schema transaction")','SET @dummy = 0');
2760PREPARE stmt FROM @str;
2761EXECUTE stmt;
2762DROP PREPARE stmt;
2763
2764# ndbinfo.config_params
2765SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`config_params` (param_number INT UNSIGNED PRIMARY KEY, param_name VARCHAR(512))','SET @dummy = 0');
2766PREPARE stmt FROM @str;
2767EXECUTE stmt;
2768DROP PREPARE stmt;
2769
2770SET @str=IF(@have_ndbinfo,'INSERT INTO `ndbinfo`.`config_params` VALUES (179, "MaxNoOfSubscriptions"), (180, "MaxNoOfSubscribers"), (181, "MaxNoOfConcurrentSubOperations"), (5, "HostName"), (3, "NodeId"), (101, "NoOfReplicas"), (103, "MaxNoOfAttributes"), (102, "MaxNoOfTables"), (149, "MaxNoOfOrderedIndexes"), (150, "MaxNoOfUniqueHashIndexes"), (110, "MaxNoOfConcurrentIndexOperations"), (105, "MaxNoOfTriggers"), (109, "MaxNoOfFiredTriggers"), (100, "MaxNoOfSavedMessages"), (177, "LockExecuteThreadToCPU"), (178, "LockMaintThreadsToCPU"), (176, "RealtimeScheduler"), (114, "LockPagesInMainMemory"), (123, "TimeBetweenWatchDogCheck"), (174, "SchedulerExecutionTimer"), (175, "SchedulerSpinTimer"), (141, "TimeBetweenWatchDogCheckInitial"), (124, "StopOnError"), (107, "MaxNoOfConcurrentOperations"), (627, "MaxDMLOperationsPerTransaction"), (151, "MaxNoOfLocalOperations"), (152, "MaxNoOfLocalScans"), (153, "BatchSizePerLocalScan"), (106, "MaxNoOfConcurrentTransactions"), (108, "MaxNoOfConcurrentScans"), (111, "TransactionBufferMemory"), (113, "IndexMemory"), (112, "DataMemory"), (154, "UndoIndexBuffer"), (155, "UndoDataBuffer"), (156, "RedoBuffer"), (157, "LongMessageBuffer"), (160, "DiskPageBufferMemory"), (198, "SharedGlobalMemory"), (115, "StartPartialTimeout"), (116, "StartPartitionedTimeout"), (117, "StartFailureTimeout"), (619, "StartNoNodegroupTimeout"), (118, "HeartbeatIntervalDbDb"), (618, "ConnectCheckIntervalDelay"), (119, "HeartbeatIntervalDbApi"), (120, "TimeBetweenLocalCheckpoints"), (121, "TimeBetweenGlobalCheckpoints"), (170, "TimeBetweenEpochs"), (171, "TimeBetweenEpochsTimeout"), (182, "MaxBufferedEpochs"), (632, "NoOfFragmentLogParts"), (126, "NoOfFragmentLogFiles"), (140, "FragmentLogFileSize"), (189, "InitFragmentLogFiles"), (190, "DiskIOThreadPool"), (159, "MaxNoOfOpenFiles"), (162, "InitialNoOfOpenFiles"), (129, "TimeBetweenInactiveTransactionAbortCheck"), (130, "TransactionInactiveTimeout"), (131, "TransactionDeadlockDetectionTimeout"), (148, "Diskless"), (122, "ArbitrationTimeout"), (142, "Arbitration"), (7, "DataDir"), (125, "FileSystemPath"), (250, "LogLevelStartup"), (251, "LogLevelShutdown"), (252, "LogLevelStatistic"), (253, "LogLevelCheckpoint"), (254, "LogLevelNodeRestart"), (255, "LogLevelConnection"), (259, "LogLevelCongestion"), (258, "LogLevelError"), (256, "LogLevelInfo"), (158, "BackupDataDir"), (163, "DiskSyncSize"), (164, "DiskCheckpointSpeed"), (165, "DiskCheckpointSpeedInRestart"), (133, "BackupMemory"), (134, "BackupDataBufferSize"), (135, "BackupLogBufferSize"), (136, "BackupWriteSize"), (139, "BackupMaxWriteSize"), (161, "StringMemory"), (169, "MaxAllocate"), (166, "MemReportFrequency"), (167, "BackupReportFrequency"), (184, "StartupStatusReportFrequency"), (168, "ODirect"), (172, "CompressedBackup"), (173, "CompressedLCP"), (203, "ExtraSendBufferMemory"), (9, "TotalSendBufferMemory"), (185, "Nodegroup"), (186, "MaxNoOfExecutionThreads"), (188, "__ndbmt_lqh_workers"), (187, "__ndbmt_lqh_threads"), (191, "__ndbmt_classic"), (628, "ThreadConfig"), (193, "FileSystemPathDD"), (194, "FileSystemPathDataFiles"), (195, "FileSystemPathUndoFiles"), (196, "InitialLogfileGroup"), (197, "InitialTablespace"), (605, "MaxLCPStartDelay"), (606, "BuildIndexThreads"), (607, "HeartbeatOrder"), (608, "DictTrace"), (609, "MaxStartFailRetries"), (610, "StartFailRetryDelay"), (613, "EventLogBufferSize"), (614, "Numa"), (611, "RedoOverCommitLimit"), (612, "RedoOverCommitCounter"), (615, "LateAlloc"), (616, "TwoPassInitialNodeRestartCopy"), (617, "MaxParallelScansPerFragment"), (620, "IndexStatAutoCreate"), (621, "IndexStatAutoUpdate"), (622, "IndexStatSaveSize"), (623, "IndexStatSaveScale"), (624, "IndexStatTriggerPct"), (625, "IndexStatTriggerScale"), (626, "IndexStatUpdateDelay"), (629, "CrashOnCorruptedTuple"), (630, "MinFreePct")','SET @dummy = 0');
2771PREPARE stmt FROM @str;
2772EXECUTE stmt;
2773DROP PREPARE stmt;
2774
2775# ndbinfo.ndb$dbtc_apiconnect_state
2776SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$dbtc_apiconnect_state` (state_int_value INT UNSIGNED PRIMARY KEY, state_name VARCHAR(256), state_friendly_name VARCHAR(256), state_description VARCHAR(256))','SET @dummy = 0');
2777PREPARE stmt FROM @str;
2778EXECUTE stmt;
2779DROP PREPARE stmt;
2780
2781SET @str=IF(@have_ndbinfo,'INSERT INTO `ndbinfo`.`ndb$dbtc_apiconnect_state` VALUES (0, "CS_CONNECTED", "Connected", "An allocated idle transaction object"), (1, "CS_DISCONNECTED", "Disconnected", "An unallocated connection object"), (2, "CS_STARTED", "Started", "A started transaction"), (3, "CS_RECEIVING", "Receiving", "A transaction receiving operations"), (7, "CS_RESTART", "", ""), (8, "CS_ABORTING", "Aborting", "A transaction aborting"), (9, "CS_COMPLETING", "Completing", "A transaction completing"), (10, "CS_COMPLETE_SENT", "Completing", "A transaction completing"), (11, "CS_PREPARE_TO_COMMIT", "", ""), (12, "CS_COMMIT_SENT", "Committing", "A transaction committing"), (13, "CS_START_COMMITTING", "", ""), (14, "CS_COMMITTING", "Committing", "A transaction committing"), (15, "CS_REC_COMMITTING", "", ""), (16, "CS_WAIT_ABORT_CONF", "Aborting", ""), (17, "CS_WAIT_COMPLETE_CONF", "Completing", ""), (18, "CS_WAIT_COMMIT_CONF", "Committing", ""), (19, "CS_FAIL_ABORTING", "TakeOverAborting", ""), (20, "CS_FAIL_ABORTED", "TakeOverAborting", ""), (21, "CS_FAIL_PREPARED", "", ""), (22, "CS_FAIL_COMMITTING", "TakeOverCommitting", ""), (23, "CS_FAIL_COMMITTED", "TakeOverCommitting", ""), (24, "CS_FAIL_COMPLETED", "TakeOverCompleting", ""), (25, "CS_START_SCAN", "Scanning", ""), (26, "CS_SEND_FIRE_TRIG_REQ", "Precomitting", ""), (27, "CS_WAIT_FIRE_TRIG_REQ", "Precomitting", "")','SET @dummy = 0');
2782PREPARE stmt FROM @str;
2783EXECUTE stmt;
2784DROP PREPARE stmt;
2785
2786# ndbinfo.ndb$dblqh_tcconnect_state
2787SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$dblqh_tcconnect_state` (state_int_value INT UNSIGNED PRIMARY KEY, state_name VARCHAR(256), state_friendly_name VARCHAR(256), state_description VARCHAR(256))','SET @dummy = 0');
2788PREPARE stmt FROM @str;
2789EXECUTE stmt;
2790DROP PREPARE stmt;
2791
2792SET @str=IF(@have_ndbinfo,'INSERT INTO `ndbinfo`.`ndb$dblqh_tcconnect_state` VALUES (0, "IDLE", "Idle", ""), (1, "WAIT_ACC", "WaitLock", ""), (2, "WAIT_TUPKEYINFO", "", ""), (3, "WAIT_ATTR", "WaitData", ""), (4, "WAIT_TUP", "WaitTup", ""), (5, "STOPPED", "Stopped", ""), (6, "LOG_QUEUED", "LogPrepare", ""), (7, "PREPARED", "Prepared", ""), (8, "LOG_COMMIT_WRITTEN_WAIT_SIGNAL", "", ""), (9, "LOG_COMMIT_QUEUED_WAIT_SIGNAL", "", ""), (10, "COMMIT_STOPPED", "CommittingStopped", ""), (11, "LOG_COMMIT_QUEUED", "Committing", ""), (12, "COMMIT_QUEUED", "Committing", ""), (13, "COMMITTED", "Committed", ""), (35, "WAIT_TUP_COMMIT", "Committing", ""), (14, "WAIT_ACC_ABORT", "Aborting", ""), (15, "ABORT_QUEUED", "Aborting", ""), (16, "ABORT_STOPPED", "AbortingStopped", ""), (17, "WAIT_AI_AFTER_ABORT", "Aborting", ""), (18, "LOG_ABORT_QUEUED", "Aborting", ""), (19, "WAIT_TUP_TO_ABORT", "Aborting", ""), (20, "WAIT_SCAN_AI", "Scanning", ""), (21, "SCAN_STATE_USED", "Scanning", ""), (22, "SCAN_FIRST_STOPPED", "Scanning", ""), (23, "SCAN_CHECK_STOPPED", "Scanning", ""), (24, "SCAN_STOPPED", "ScanningStopped", ""), (25, "SCAN_RELEASE_STOPPED", "ScanningStopped", ""), (26, "SCAN_CLOSE_STOPPED", "ScanningStopped", ""), (27, "COPY_CLOSE_STOPPED", "ScanningStopped", ""), (28, "COPY_FIRST_STOPPED", "ScanningStopped", ""), (29, "COPY_STOPPED", "ScanningStopped", ""), (30, "SCAN_TUPKEY", "Scanning", ""), (31, "COPY_TUPKEY", "NodeRecoveryScanning", ""), (32, "TC_NOT_CONNECTED", "Idle", ""), (33, "PREPARED_RECEIVED_COMMIT", "Committing", ""), (34, "LOG_COMMIT_WRITTEN", "Committing", "")','SET @dummy = 0');
2793PREPARE stmt FROM @str;
2794EXECUTE stmt;
2795DROP PREPARE stmt;
2796
2797# ndbinfo.transporters
2798SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`transporters` AS SELECT node_id, remote_node_id, CASE connection_status WHEN 0 THEN "CONNECTED" WHEN 1 THEN "CONNECTING" WHEN 2 THEN "DISCONNECTED" WHEN 3 THEN "DISCONNECTING" ELSE NULL END AS status, remote_address, bytes_sent, bytes_received, connect_count, overloaded, overload_count, slowdown, slowdown_count FROM `ndbinfo`.`ndb$transporters`','SET @dummy = 0');
2799PREPARE stmt FROM @str;
2800EXECUTE stmt;
2801DROP PREPARE stmt;
2802
2803# ndbinfo.logspaces
2804SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`logspaces` AS SELECT node_id, CASE log_type WHEN 0 THEN "REDO" WHEN 1 THEN "DD-UNDO" ELSE NULL END AS log_type, log_id, log_part, total, used FROM `ndbinfo`.`ndb$logspaces`','SET @dummy = 0');
2805PREPARE stmt FROM @str;
2806EXECUTE stmt;
2807DROP PREPARE stmt;
2808
2809# ndbinfo.logbuffers
2810SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`logbuffers` AS SELECT node_id, CASE log_type WHEN 0 THEN "REDO" WHEN 1 THEN "DD-UNDO" ELSE "<unknown>" END AS log_type, log_id, log_part, total, used FROM `ndbinfo`.`ndb$logbuffers`','SET @dummy = 0');
2811PREPARE stmt FROM @str;
2812EXECUTE stmt;
2813DROP PREPARE stmt;
2814
2815# ndbinfo.resources
2816SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`resources` AS SELECT node_id, CASE resource_id WHEN 0 THEN "RESERVED" WHEN 1 THEN "DISK_OPERATIONS" WHEN 2 THEN "DISK_RECORDS" WHEN 3 THEN "DATA_MEMORY" WHEN 4 THEN "JOBBUFFER" WHEN 5 THEN "FILE_BUFFERS" WHEN 6 THEN "TRANSPORTER_BUFFERS" WHEN 7 THEN "DISK_PAGE_BUFFER" WHEN 8 THEN "QUERY_MEMORY" WHEN 9 THEN "SCHEMA_TRANS_MEMORY" ELSE "<unknown>" END AS resource_name, reserved, used, max FROM `ndbinfo`.`ndb$resources`','SET @dummy = 0');
2817PREPARE stmt FROM @str;
2818EXECUTE stmt;
2819DROP PREPARE stmt;
2820
2821# ndbinfo.counters
2822SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`counters` AS SELECT node_id, b.block_name, block_instance, counter_id, CASE counter_id WHEN 1 THEN "ATTRINFO" WHEN 2 THEN "TRANSACTIONS" WHEN 3 THEN "COMMITS" WHEN 4 THEN "READS" WHEN 5 THEN "SIMPLE_READS" WHEN 6 THEN "WRITES" WHEN 7 THEN "ABORTS" WHEN 8 THEN "TABLE_SCANS" WHEN 9 THEN "RANGE_SCANS" WHEN 10 THEN "OPERATIONS" WHEN 11 THEN "READS_RECEIVED" WHEN 12 THEN "LOCAL_READS_SENT" WHEN 13 THEN "REMOTE_READS_SENT" WHEN 14 THEN "READS_NOT_FOUND" WHEN 15 THEN "TABLE_SCANS_RECEIVED" WHEN 16 THEN "LOCAL_TABLE_SCANS_SENT" WHEN 17 THEN "RANGE_SCANS_RECEIVED" WHEN 18 THEN "LOCAL_RANGE_SCANS_SENT" WHEN 19 THEN "REMOTE_RANGE_SCANS_SENT" WHEN 20 THEN "SCAN_BATCHES_RETURNED" WHEN 21 THEN "SCAN_ROWS_RETURNED" WHEN 22 THEN "PRUNED_RANGE_SCANS_RECEIVED" WHEN 23 THEN "CONST_PRUNED_RANGE_SCANS_RECEIVED" WHEN 24 THEN "LOCAL_READS" WHEN 25 THEN "LOCAL_WRITES" WHEN 26 THEN "LQHKEY_OVERLOAD" WHEN 27 THEN "LQHKEY_OVERLOAD_TC" WHEN 28 THEN "LQHKEY_OVERLOAD_READER" WHEN 29 THEN "LQHKEY_OVERLOAD_NODE_PEER" WHEN 30 THEN "LQHKEY_OVERLOAD_SUBSCRIBER" WHEN 31 THEN "LQHSCAN_SLOWDOWNS" ELSE "<unknown>" END AS counter_name, val FROM `ndbinfo`.`ndb$counters` c LEFT JOIN `ndbinfo`.blocks b ON c.block_number = b.block_number','SET @dummy = 0');
2823PREPARE stmt FROM @str;
2824EXECUTE stmt;
2825DROP PREPARE stmt;
2826
2827# ndbinfo.nodes
2828SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`nodes` AS SELECT node_id, uptime, CASE status WHEN 0 THEN "NOTHING" WHEN 1 THEN "CMVMI" WHEN 2 THEN "STARTING" WHEN 3 THEN "STARTED" WHEN 4 THEN "SINGLEUSER" WHEN 5 THEN "STOPPING_1" WHEN 6 THEN "STOPPING_2" WHEN 7 THEN "STOPPING_3" WHEN 8 THEN "STOPPING_4" ELSE "<unknown>" END AS status, start_phase, config_generation FROM `ndbinfo`.`ndb$nodes`','SET @dummy = 0');
2829PREPARE stmt FROM @str;
2830EXECUTE stmt;
2831DROP PREPARE stmt;
2832
2833# ndbinfo.memoryusage
2834SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`memoryusage` AS SELECT node_id, pool_name AS memory_type, SUM(used*entry_size) AS used, SUM(used) AS used_pages, SUM(total*entry_size) AS total, SUM(total) AS total_pages FROM `ndbinfo`.`ndb$pools` WHERE (block_number IN (248, 254) AND (pool_name = "Index memory" OR pool_name = "Data memory")) OR pool_name = "Long message buffer" GROUP BY node_id, memory_type','SET @dummy = 0');
2835PREPARE stmt FROM @str;
2836EXECUTE stmt;
2837DROP PREPARE stmt;
2838
2839# ndbinfo.diskpagebuffer
2840SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`diskpagebuffer` AS SELECT node_id, block_instance, pages_written, pages_written_lcp, pages_read, log_waits, page_requests_direct_return, page_requests_wait_queue, page_requests_wait_io FROM `ndbinfo`.`ndb$diskpagebuffer`','SET @dummy = 0');
2841PREPARE stmt FROM @str;
2842EXECUTE stmt;
2843DROP PREPARE stmt;
2844
2845# ndbinfo.diskpagebuffer
2846SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`diskpagebuffer` AS SELECT node_id, block_instance, pages_written, pages_written_lcp, pages_read, log_waits, page_requests_direct_return, page_requests_wait_queue, page_requests_wait_io FROM `ndbinfo`.`ndb$diskpagebuffer`','SET @dummy = 0');
2847PREPARE stmt FROM @str;
2848EXECUTE stmt;
2849DROP PREPARE stmt;
2850
2851# ndbinfo.threadblocks
2852SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`threadblocks` AS SELECT t.node_id, t.thr_no, b.block_name, t.block_instance FROM `ndbinfo`.`ndb$threadblocks` t LEFT JOIN `ndbinfo`.blocks b ON t.block_number = b.block_number','SET @dummy = 0');
2853PREPARE stmt FROM @str;
2854EXECUTE stmt;
2855DROP PREPARE stmt;
2856
2857# ndbinfo.threadstat
2858SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`threadstat` AS SELECT * from `ndbinfo`.`ndb$threadstat`','SET @dummy = 0');
2859PREPARE stmt FROM @str;
2860EXECUTE stmt;
2861DROP PREPARE stmt;
2862
2863# ndbinfo.cluster_transactions
2864SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`cluster_transactions` AS SELECT t.node_id, t.block_instance, t.transid0 + (t.transid1 << 32) as transid, s.state_friendly_name as state, t.c_ops as count_operations, t.outstanding as outstanding_operations, t.timer as inactive_seconds, (t.apiref & 65535) as client_node_id, (t.apiref >> 16) as client_block_ref FROM `ndbinfo`.`ndb$transactions` t LEFT JOIN `ndbinfo`.`ndb$dbtc_apiconnect_state` s ON s.state_int_value = t.state','SET @dummy = 0');
2865PREPARE stmt FROM @str;
2866EXECUTE stmt;
2867DROP PREPARE stmt;
2868
2869# ndbinfo.server_transactions
2870SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`server_transactions` AS SELECT map.mysql_connection_id, t.*FROM information_schema.ndb_transid_mysql_connection_map map JOIN `ndbinfo`.cluster_transactions t ON (map.ndb_transid >> 32) = (t.transid >> 32)','SET @dummy = 0');
2871PREPARE stmt FROM @str;
2872EXECUTE stmt;
2873DROP PREPARE stmt;
2874
2875# ndbinfo.cluster_operations
2876SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`cluster_operations` AS SELECT o.node_id, o.block_instance, o.transid0 + (o.transid1 << 32) as transid, case o.op when 1 then "READ" when 2 then "READ-SH" when 3 then "READ-EX" when 4 then "INSERT" when 5 then "UPDATE" when 6 then "DELETE" when 7 then "WRITE" when 8 then "UNLOCK" when 9 then "REFRESH" when 257 then "SCAN" when 258 then "SCAN-SH" when 259 then "SCAN-EX" ELSE "<unknown>" END as operation_type, s.state_friendly_name as state, o.tableid, o.fragmentid, (o.apiref & 65535) as client_node_id, (o.apiref >> 16) as client_block_ref, (o.tcref & 65535) as tc_node_id, ((o.tcref >> 16) & 511) as tc_block_no, ((o.tcref >> (16 + 9)) & 127) as tc_block_instance FROM `ndbinfo`.`ndb$operations` o LEFT JOIN `ndbinfo`.`ndb$dblqh_tcconnect_state` s ON s.state_int_value = o.state','SET @dummy = 0');
2877PREPARE stmt FROM @str;
2878EXECUTE stmt;
2879DROP PREPARE stmt;
2880
2881# ndbinfo.server_operations
2882SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`server_operations` AS SELECT map.mysql_connection_id, o.* FROM `ndbinfo`.cluster_operations o JOIN information_schema.ndb_transid_mysql_connection_map map ON (map.ndb_transid >> 32) = (o.transid >> 32)','SET @dummy = 0');
2883PREPARE stmt FROM @str;
2884EXECUTE stmt;
2885DROP PREPARE stmt;
2886
2887# ndbinfo.membership
2888SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`membership` AS SELECT node_id, group_id, left_node, right_node, president, successor, dynamic_id & 0xFFFF AS succession_order, dynamic_id >> 16 AS Conf_HB_order, arbitrator, arb_ticket, CASE arb_state WHEN 0 THEN "ARBIT_NULL" WHEN 1 THEN "ARBIT_INIT" WHEN 2 THEN "ARBIT_FIND" WHEN 3 THEN "ARBIT_PREP1" WHEN 4 THEN "ARBIT_PREP2" WHEN 5 THEN "ARBIT_START" WHEN 6 THEN "ARBIT_RUN" WHEN 7 THEN "ARBIT_CHOOSE" WHEN 8 THEN "ARBIT_CRASH" ELSE "UNKNOWN" END AS arb_state, CASE arb_connected WHEN 1 THEN "Yes" ELSE "No" END AS arb_connected, conn_rank1_arbs AS connected_rank1_arbs, conn_rank2_arbs AS connected_rank2_arbs FROM `ndbinfo`.`ndb$membership`','SET @dummy = 0');
2889PREPARE stmt FROM @str;
2890EXECUTE stmt;
2891DROP PREPARE stmt;
2892
2893# ndbinfo.arbitrator_validity_detail
2894SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`arbitrator_validity_detail` AS SELECT node_id, arbitrator, arb_ticket, CASE arb_connected WHEN 1 THEN "Yes" ELSE "No" END AS arb_connected, CASE arb_state WHEN 0 THEN "ARBIT_NULL" WHEN 1 THEN "ARBIT_INIT" WHEN 2 THEN "ARBIT_FIND" WHEN 3 THEN "ARBIT_PREP1" WHEN 4 THEN "ARBIT_PREP2" WHEN 5 THEN "ARBIT_START" WHEN 6 THEN "ARBIT_RUN" WHEN 7 THEN "ARBIT_CHOOSE" WHEN 8 THEN "ARBIT_CRASH" ELSE "UNKNOWN" END AS arb_state FROM `ndbinfo`.`ndb$membership` ORDER BY arbitrator, arb_connected DESC','SET @dummy = 0');
2895PREPARE stmt FROM @str;
2896EXECUTE stmt;
2897DROP PREPARE stmt;
2898
2899# ndbinfo.arbitrator_validity_summary
2900SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`arbitrator_validity_summary` AS SELECT arbitrator, arb_ticket, CASE arb_connected WHEN 1 THEN "Yes" ELSE "No" END AS arb_connected, count(*) as consensus_count FROM `ndbinfo`.`ndb$membership` GROUP BY arbitrator, arb_ticket, arb_connected','SET @dummy = 0');
2901PREPARE stmt FROM @str;
2902EXECUTE stmt;
2903DROP PREPARE stmt;
2904
2905
2906# ndbinfo.memory_per_fragment
2907# The test for name.type<=6 is there to elimiate matching non-table objects
2908# (triggers, files etc.), since the 'id' of these may collide with table ids.
2909SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`memory_per_fragment` AS SELECT name.fq_name, parent_name.fq_name AS parent_fq_name, types.type_name AS type, table_id, node_id, block_instance, fragment_num, fixed_elem_alloc_bytes, fixed_elem_free_bytes, fixed_elem_size_bytes, fixed_elem_count, FLOOR(fixed_elem_free_bytes/fixed_elem_size_bytes) AS fixed_elem_free_rows, var_elem_alloc_bytes, var_elem_free_bytes, var_elem_count, hash_index_alloc_bytes FROM ndbinfo.ndb$frag_mem_use AS space JOIN ndbinfo.ndb$dict_obj_info AS name ON name.id=space.table_id AND name.type<=6 JOIN ndbinfo.dict_obj_types AS types ON name.type=types.type_id LEFT JOIN ndbinfo.ndb$dict_obj_info AS parent_name ON name.parent_obj_id=parent_name.id AND name.parent_obj_type=parent_name.type','SET @dummy = 0');
2910PREPARE stmt FROM @str;
2911EXECUTE stmt;
2912DROP PREPARE stmt;
2913
2914# Finally turn off offline mode
2915SET @str=IF(@have_ndbinfo,'SET @@global.ndbinfo_offline=FALSE','SET @dummy = 0');
2916PREPARE stmt FROM @str;
2917EXECUTE stmt;
2918DROP PREPARE stmt;