1drop schema if exists test1;
2drop table  if exists test.t1;
3create schema test1;
4create table test.t1 (col1 bigint, col2 varchar(30)) engine = myisam;
5insert into test.t1 values(1,'One');
6create table test1.t2 like test.t1;
7show create table test.t1;
8Table	Create Table
9t1	CREATE TABLE `t1` (
10  `col1` bigint(20) DEFAULT NULL,
11  `col2` varchar(30) DEFAULT NULL
12) ENGINE=MyISAM DEFAULT CHARSET=latin1
13show create table test1.t2;
14Table	Create Table
15t2	CREATE TABLE `t2` (
16  `col1` bigint(20) DEFAULT NULL,
17  `col2` varchar(30) DEFAULT NULL
18) ENGINE=MyISAM DEFAULT CHARSET=latin1
19drop table if exists test.marker;
20create table test.marker(a int);
21update performance_schema.setup_consumers set enabled='NO';
22update performance_schema.setup_instruments set enabled='NO';
23update performance_schema.setup_instruments set enabled='YES'
24  where name like "wait/io/table/%";
25truncate table performance_schema.events_waits_history_long;
26flush status;
27flush tables;
28update performance_schema.setup_consumers set enabled = 'YES';
29insert into test1.t2 select * from test.t1;
30insert into marker set a = 1;
31select * from test.t1 natural join test1.t2;
32col1	col2
331	One
34insert into marker set a = 1;
35select * from test.t1 where col2 = (select col2 from test1.t2 where test.t1.col1 = test1.t2.col1);
36col1	col2
371	One
38insert into marker set a = 1;
39update test.t1 AS a natural join test1.t2 AS b SET a.col2 = 'updated' , b.col2 = 'updated';
40insert into marker set a = 1;
41delete from test.t1, test1.t2 using test.t1 inner join test1.t2
42where test.t1.col1 = test1.t2.col1;
43update performance_schema.setup_consumers set enabled='NO';
44select event_name,
45left(source, locate(":", source)) as short_source,
46object_type, object_schema,
47if (locate("#sql-", object_name), "#sql-XXXX", object_name)
48as pretty_name,
49operation, number_of_bytes
50from performance_schema.events_waits_history_long
51where event_name like 'wait/io/table/%'
52  and object_schema in ('test','test1')
53order by thread_id, event_id;
54event_name	short_source	object_type	object_schema	pretty_name	operation	number_of_bytes
55wait/io/table/sql/handler	handler.cc:	TABLE	test1	t2	insert	NULL
56wait/io/table/sql/handler	handler.cc:	TABLE	test	marker	insert	NULL
57wait/io/table/sql/handler	handler.cc:	TABLE	test	marker	insert	NULL
58wait/io/table/sql/handler	handler.cc:	TABLE	test	marker	insert	NULL
59wait/io/table/sql/handler	handler.cc:	TABLE	test	t1	update	NULL
60wait/io/table/sql/handler	handler.cc:	TABLE	test1	t2	fetch	NULL
61wait/io/table/sql/handler	handler.cc:	TABLE	test1	t2	update	NULL
62wait/io/table/sql/handler	handler.cc:	TABLE	test	marker	insert	NULL
63wait/io/table/sql/handler	handler.cc:	TABLE	test	t1	delete	NULL
64wait/io/table/sql/handler	handler.cc:	TABLE	test1	t2	fetch	NULL
65wait/io/table/sql/handler	handler.cc:	TABLE	test1	t2	delete	NULL
66show status like 'performance_schema_%';
67Variable_name	Value
68Performance_schema_accounts_lost	0
69Performance_schema_cond_classes_lost	0
70Performance_schema_cond_instances_lost	0
71Performance_schema_digest_lost	0
72Performance_schema_file_classes_lost	0
73Performance_schema_file_handles_lost	0
74Performance_schema_file_instances_lost	0
75Performance_schema_hosts_lost	0
76Performance_schema_locker_lost	0
77Performance_schema_mutex_classes_lost	0
78Performance_schema_mutex_instances_lost	0
79Performance_schema_rwlock_classes_lost	0
80Performance_schema_rwlock_instances_lost	0
81Performance_schema_session_connect_attrs_lost	0
82Performance_schema_socket_classes_lost	0
83Performance_schema_socket_instances_lost	0
84Performance_schema_stage_classes_lost	0
85Performance_schema_statement_classes_lost	0
86Performance_schema_table_handles_lost	0
87Performance_schema_table_instances_lost	0
88Performance_schema_thread_classes_lost	0
89Performance_schema_thread_instances_lost	0
90Performance_schema_users_lost	0
91truncate performance_schema.events_waits_history_long;
92flush status;
93drop table test.t1;
94drop schema test1;
95update performance_schema.setup_consumers set enabled='NO';
96truncate performance_schema.events_waits_history_long;
97drop table test.marker;
98flush status;
99update performance_schema.setup_instruments set enabled='YES';
100update performance_schema.setup_consumers set enabled='YES';
101