1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304
|
SELECT object_type, object_schema, object_name FROM performance_schema.objects_summary_global_by_type
WHERE object_schema='test';
object_type object_schema object_name
CREATE TABLE test.t_before(a INT);
INSERT INTO test.t_before VALUES (1);
SELECT object_type, object_schema, object_name FROM performance_schema.objects_summary_global_by_type
WHERE object_schema='test';
object_type object_schema object_name
TABLE test t_before
RENAME TABLE test.t_before TO test.t_after;
SELECT COUNT(*) FROM test.t_after;
COUNT(*)
1
SELECT object_type, object_schema, object_name FROM performance_schema.objects_summary_global_by_type
WHERE object_schema='test';
object_type object_schema object_name
TABLE test t_after
DROP TABLE test.t_after;
SELECT object_type, object_schema, object_name FROM performance_schema.objects_summary_global_by_type
WHERE object_schema='test';
object_type object_schema object_name
SELECT object_type, object_schema, object_name FROM performance_schema.objects_summary_global_by_type
WHERE object_schema='test';
object_type object_schema object_name
CREATE EVENT test.e_before ON SCHEDULE EVERY 1 SECOND DO SELECT 1;
SELECT sleep(5);
sleep(5)
0
SELECT object_type, object_schema, object_name FROM performance_schema.objects_summary_global_by_type
WHERE object_schema='test';
object_type object_schema object_name
EVENT test e_before
ALTER EVENT test.e_before RENAME TO test.e_after;
SELECT sleep(5);
sleep(5)
0
SELECT object_type, object_schema, object_name FROM performance_schema.objects_summary_global_by_type
WHERE object_schema='test';
object_type object_schema object_name
EVENT test e_after
DROP EVENT test.e_after;
SELECT object_type, object_schema, object_name FROM performance_schema.objects_summary_global_by_type
WHERE object_schema='test';
object_type object_schema object_name
CREATE TABLE test.t1(a INT);
INSERT INTO test.t1 VALUES (1);
CREATE VIEW test.v1 AS SELECT * FROM test.t1;
SELECT COUNT(*) FROM test.v1;
COUNT(*)
1
SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
WHERE object_schema='test';
object_schema object_name
test t1
DROP VIEW test.v1;
DROP TABLE test.t1;
SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
WHERE object_schema='test';
object_schema object_name
SELECT EVENT_ID FROM performance_schema.events_waits_current
WHERE THREAD_ID IN
(SELECT THREAD_ID FROM performance_schema.threads)
AND EVENT_NAME IN
(SELECT NAME FROM performance_schema.setup_instruments
WHERE NAME LIKE "wait/synch/%")
LIMIT 1;
create table test.t1(a int) engine=performance_schema;
ERROR HY000: Invalid performance_schema usage.
SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
WHERE object_schema='test';
object_schema object_name
create table test.t1 like performance_schema.events_waits_current;
ERROR HY000: Invalid performance_schema usage.
SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
WHERE object_schema='test';
object_schema object_name
create table performance_schema.t1(a int);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
WHERE object_schema='test';
object_schema object_name
drop table if exists test.ghost;
create table test.ghost (a int, b int);
alter table test.ghost add index index_a(a);
alter table test.ghost add index index_b(b);
insert into test.ghost values (1, 3);
insert into test.ghost values (2, 4);
select * from test.ghost;
a b
1 3
2 4
drop table test.ghost;
select * from performance_schema.file_instances
where file_name like "%ghost%";
FILE_NAME EVENT_NAME OPEN_COUNT
select * from performance_schema.no_such_table;
ERROR 42S02: Table 'performance_schema.no_such_table' doesn't exist
select * from performance_schema.no_such_table for update;
ERROR 42S02: Table 'performance_schema.no_such_table' doesn't exist
insert into performance_schema.no_such_table values(1);
ERROR 42S02: Table 'performance_schema.no_such_table' doesn't exist
update performance_schema.no_such_table set no_such_col = 2;
ERROR 42S02: Table 'performance_schema.no_such_table' doesn't exist
delete from performance_schema.no_such_table where no_such_col = 3;
ERROR 42S02: Table 'performance_schema.no_such_table' doesn't exist
lock table performance_schema.no_such_table read;
ERROR 42S02: Table 'performance_schema.no_such_table' doesn't exist
lock table performance_schema.no_such_table write;
ERROR 42S02: Table 'performance_schema.no_such_table' doesn't exist
show create table performance_schema.no_such_table;
ERROR 42S02: Table 'performance_schema.no_such_table' doesn't exist
show create view performance_schema.no_such_view;
ERROR 42S02: Table 'performance_schema.no_such_view' doesn't exist
drop table if exists performance_schema.no_such_table;
Warnings:
Note 1051 Unknown table 'performance_schema.no_such_table'
DROP TABLE IF EXISTS t_60905;
CREATE TABLE t_60905 (i INT, j INT, KEY(i)) ENGINE = InnoDB;
INSERT INTO t_60905 VALUES
(1,2), (3,4), (5,6), (7,8), (9,10);
DELETE FROM t_60905 WHERE i = 1;
DELETE FROM t_60905 WHERE j = 8;
SELECT object_schema,
object_name,
index_name,
count_fetch,
count_insert,
count_update,
count_delete
FROM performance_schema.table_io_waits_summary_by_index_usage
WHERE object_schema = 'test'
AND object_name = 't_60905';
object_schema object_name index_name count_fetch count_insert count_update count_delete
test t_60905 i 2 0 0 1
test t_60905 NULL 5 5 0 1
DROP TABLE t_60905;
show global variables like "performance_schema_max_thread_instances";
Variable_name Value
performance_schema_max_thread_instances -1
explain select * from performance_schema.threads;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE threads NULL ALL NULL NULL NULL NULL 256 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select `performance_schema`.`threads`.`THREAD_ID` AS `THREAD_ID`,`performance_schema`.`threads`.`NAME` AS `NAME`,`performance_schema`.`threads`.`TYPE` AS `TYPE`,`performance_schema`.`threads`.`PROCESSLIST_ID` AS `PROCESSLIST_ID`,`performance_schema`.`threads`.`PROCESSLIST_USER` AS `PROCESSLIST_USER`,`performance_schema`.`threads`.`PROCESSLIST_HOST` AS `PROCESSLIST_HOST`,`performance_schema`.`threads`.`PROCESSLIST_DB` AS `PROCESSLIST_DB`,`performance_schema`.`threads`.`PROCESSLIST_COMMAND` AS `PROCESSLIST_COMMAND`,`performance_schema`.`threads`.`PROCESSLIST_TIME` AS `PROCESSLIST_TIME`,`performance_schema`.`threads`.`PROCESSLIST_STATE` AS `PROCESSLIST_STATE`,`performance_schema`.`threads`.`PROCESSLIST_INFO` AS `PROCESSLIST_INFO`,`performance_schema`.`threads`.`PARENT_THREAD_ID` AS `PARENT_THREAD_ID`,`performance_schema`.`threads`.`ROLE` AS `ROLE`,`performance_schema`.`threads`.`INSTRUMENTED` AS `INSTRUMENTED`,`performance_schema`.`threads`.`HISTORY` AS `HISTORY`,`performance_schema`.`threads`.`CONNECTION_TYPE` AS `CONNECTION_TYPE`,`performance_schema`.`threads`.`THREAD_OS_ID` AS `THREAD_OS_ID`,`performance_schema`.`threads`.`RESOURCE_GROUP` AS `RESOURCE_GROUP`,`performance_schema`.`threads`.`EXECUTION_ENGINE` AS `EXECUTION_ENGINE`,`performance_schema`.`threads`.`CONTROLLED_MEMORY` AS `CONTROLLED_MEMORY`,`performance_schema`.`threads`.`MAX_CONTROLLED_MEMORY` AS `MAX_CONTROLLED_MEMORY`,`performance_schema`.`threads`.`TOTAL_MEMORY` AS `TOTAL_MEMORY`,`performance_schema`.`threads`.`MAX_TOTAL_MEMORY` AS `MAX_TOTAL_MEMORY`,`performance_schema`.`threads`.`TELEMETRY_ACTIVE` AS `TELEMETRY_ACTIVE` from `performance_schema`.`threads`
use performance_schema;
show events;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
show events from performance_schema;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
show events where Db= 'performance_schema';
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
use test;
use test;
truncate performance_schema.events_statements_history;
truncate performance_schema.events_statements_history_long;
select * from t1;
ERROR 42S02: Table 'test.t1' doesn't exist
select mysql_errno, returned_sqlstate, message_text, errors, warnings
from performance_schema.events_statements_history where errors > 0;
mysql_errno returned_sqlstate message_text errors warnings
1146 42S02 Table 'test.t1' doesn't exist 1 0
select mysql_errno, returned_sqlstate, message_text, errors, warnings from
performance_schema.events_statements_history_long where errors > 0;
mysql_errno returned_sqlstate message_text errors warnings
1146 42S02 Table 'test.t1' doesn't exist 1 0
use performance_schema;
truncate performance_schema.events_statements_history;
set names latin1;
select 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
select _utf8mb4 'ваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑваÑÑ' as B;
B
васвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвасвас
select count(*) from events_statements_history where sql_text like "%...";
count(*)
2
drop table if exists test.t1;
insert into performance_schema.setup_objects
values ('TABLE', 'test', 't1', 'YES', 'YES');
create table test.t1 (a int, b int, primary key (a), key my_index(b));
insert into test.t1 values (1, 2), (3, 4), (5, 6);
flush table test.t1;
select * from test.t1 where a = 3;
a b
3 4
select * from test.t1 where b = 4;
a b
3 4
select OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR
from performance_schema.table_lock_waits_summary_by_table
where OBJECT_NAME = 't1';
OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME COUNT_STAR
TABLE test t1 3
select OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, INDEX_NAME, COUNT_STAR
from performance_schema.table_io_waits_summary_by_index_usage
where OBJECT_NAME = 't1';
OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME INDEX_NAME COUNT_STAR
TABLE test t1 PRIMARY 1
TABLE test t1 my_index 1
TABLE test t1 NULL 3
update performance_schema.setup_objects
set timed = 'NO' where OBJECT_NAME = 't1';
select OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR
from performance_schema.table_lock_waits_summary_by_table
where OBJECT_NAME = 't1';
OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME COUNT_STAR
TABLE test t1 3
select OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, INDEX_NAME, COUNT_STAR
from performance_schema.table_io_waits_summary_by_index_usage
where OBJECT_NAME = 't1';
OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME INDEX_NAME COUNT_STAR
TABLE test t1 PRIMARY 1
TABLE test t1 my_index 1
TABLE test t1 NULL 3
update performance_schema.setup_objects
set enabled = 'NO' where OBJECT_NAME = 't1';
select OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR
from performance_schema.table_lock_waits_summary_by_table
where OBJECT_NAME = 't1';
OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME COUNT_STAR
TABLE test t1 3
select OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, INDEX_NAME, COUNT_STAR
from performance_schema.table_io_waits_summary_by_index_usage
where OBJECT_NAME = 't1';
OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME INDEX_NAME COUNT_STAR
TABLE test t1 PRIMARY 1
TABLE test t1 my_index 1
TABLE test t1 NULL 3
update performance_schema.setup_objects
set enabled = 'YES' where OBJECT_NAME = 't1';
select OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR
from performance_schema.table_lock_waits_summary_by_table
where OBJECT_NAME = 't1';
OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME COUNT_STAR
TABLE test t1 3
select OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, INDEX_NAME, COUNT_STAR
from performance_schema.table_io_waits_summary_by_index_usage
where OBJECT_NAME = 't1';
OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME INDEX_NAME COUNT_STAR
TABLE test t1 PRIMARY 1
TABLE test t1 my_index 1
TABLE test t1 NULL 3
drop table test.t1;
delete from performance_schema.setup_objects
where (OBJECT_TYPE = 'TABLE')
and (OBJECT_SCHEMA = 'test')
and (OBJECT_NAME = 't1');
#
# Bug#31544023 INCONSISTENCY JOINING PERFSCHEMA TABLES WHEN PK IS > 48 CHARS
#
# String key comparisons sometimes failed with fields defined with utf8mb4.
#
# Test key comparisons on varying CHANNEL_NAME lengths.
# Both tables are defined with CHARSET = utf8mb4. The CHANNEL_NAME column is char(64).
# 20 characters
change replication source to source_host = 'test1' for channel '12345678901234567890';
# 50 characters
change replication source to source_host = 'test2' for channel '12345678901234567890123456789012345678901234567890';
# 64 characters
change replication source to source_host = 'test3' for channel '123456789012345678901234567890123456789012345678901234567890123';
# 70 characters (too long)
change replication source to source_host = 'test3' for channel '1234567890123456789012345678901234567890123456789012345678901234567890';
ERROR HY000: Couldn't create channel: Channel name is either invalid or too long.
select channel_name from performance_schema.replication_connection_configuration;
channel_name
12345678901234567890
12345678901234567890123456789012345678901234567890
123456789012345678901234567890123456789012345678901234567890123
select channel_name from performance_schema.replication_connection_status;
channel_name
12345678901234567890
12345678901234567890123456789012345678901234567890
123456789012345678901234567890123456789012345678901234567890123
select rpad(rcc.channel_name, 64, ' ') 'CHANNEL_RCC', rpad(rcs.channel_name, 64, ' ') 'CHANNEL_RCS', rcc.channel_name = rcs.channel_name 'EXPECT 1'
from performance_schema.replication_connection_configuration rcc
join performance_schema.replication_connection_status rcs on rcc.channel_name = rcs.channel_name;
CHANNEL_RCC CHANNEL_RCS EXPECT 1
12345678901234567890 12345678901234567890 1
12345678901234567890123456789012345678901234567890 12345678901234567890123456789012345678901234567890 1
123456789012345678901234567890123456789012345678901234567890123 123456789012345678901234567890123456789012345678901234567890123 1
select rpad(rcc.channel_name, 64, ' ') 'CHANNEL_RCC', rpad(rcs.channel_name, 64, ' ') 'CHANNEL_RCS', rcc.channel_name = rcs.channel_name 'EXPECT 1'
from performance_schema.replication_connection_configuration rcc
left join replication_connection_status rcs on rcc.channel_name = rcs.channel_name;
CHANNEL_RCC CHANNEL_RCS EXPECT 1
12345678901234567890 12345678901234567890 1
12345678901234567890123456789012345678901234567890 12345678901234567890123456789012345678901234567890 1
123456789012345678901234567890123456789012345678901234567890123 123456789012345678901234567890123456789012345678901234567890123 1
# Clean up
reset replica all for channel '12345678901234567890';
reset replica all for channel '12345678901234567890123456789012345678901234567890';
reset replica all for channel '123456789012345678901234567890123456789012345678901234567890123';
|