Debian Codegraph @

mysql-test/suite/perfschema/t/idx_ews_by_thread_by_event_name.test

raw
1 # Performance schema tests generally depend on specific query plans
2 # and behavior, and much of the perfschema suite is therefore disabled
3 # if the hypergraph optimizer is active.
4 --source include/not_hypergraph.inc
5
6 # Tests for PERFORMANCE_SCHEMA
7
8 select connection_id() into @conid;
9
10 select thread_id from performance_schema.threads
11 where PROCESSLIST_ID = @conid
12 into @tid;
13
14 # Test index on THREAD_ID, EVENT_NAME
15
16 --echo ############ Explain for Query ####################################
17 --replace_column 10 #
18 explain select THREAD_ID, EVENT_NAME
19 from performance_schema.events_waits_summary_by_thread_by_event_name
20 where THREAD_ID = 1;
21
22 --echo ############ Explain for Query ####################################
23 --replace_column 10 #
24 explain select *
25 from performance_schema.events_waits_summary_by_thread_by_event_name
26 where THREAD_ID > 1;
27
28 --echo ############ Explain for Query ####################################
29 --replace_column 10 #
30 explain select *
31 from performance_schema.events_waits_summary_by_thread_by_event_name
32 where THREAD_ID < 1;
33
34 --echo ############ Explain for Query ####################################
35 --replace_column 10 #
36 explain select THREAD_ID, EVENT_NAME
37 from performance_schema.events_waits_summary_by_thread_by_event_name
38 where THREAD_ID = 1 and EVENT_NAME = "impossible";
39
40 --echo ############ Explain for Query ####################################
41 --replace_column 10 #
42 explain select THREAD_ID, EVENT_NAME
43 from performance_schema.events_waits_summary_by_thread_by_event_name
44 where THREAD_ID = 99999 and EVENT_NAME = "wait/lock/table/sql/handler";
45
46 --echo ############ Explain for Query ####################################
47 --replace_column 10 #
48 explain select THREAD_ID, EVENT_NAME
49 from performance_schema.events_waits_summary_by_thread_by_event_name
50 where THREAD_ID = 1 and EVENT_NAME = "wait/lock/table/sql/handler";
51
52 --echo ############# Explain End #########################################
53
54 flush status;
55
56 select EVENT_NAME, COUNT_STAR
57 from performance_schema.events_waits_summary_by_thread_by_event_name
58 where thread_id = @tid and EVENT_NAME = "wait/lock/table/sql/handler";
59
60 let $count1 = query_get_value(show session status like "handler_read_key", Value, 1);
61
62 select EVENT_NAME, COUNT_STAR
63 from performance_schema.events_waits_summary_by_thread_by_event_name
64 where thread_id = @tid and EVENT_NAME = "wait/lock/table/sql/handler";
65
66 let $count2 = query_get_value(show session status like "handler_read_key", Value, 1);
67
68 if ($count1 < $count2)
69 {
70 --echo OK: handler_read_key incremented
71 }
72 if ($count1 >= $count2)
73 {
74 --echo ***ERROR*** handler_read_key: Before= $count1, After= $count2
75 }