1truncate table performance_schema.events_statements_history_long; 2truncate table performance_schema.events_stages_history_long; 3drop table if exists t0, t1; 4select * from performance_schema.setup_instruments where name like '%show_explain%'; 5NAME ENABLED TIMED 6wait/synch/cond/sql/show_explain YES YES 7stage/sql/Show explain YES YES 8statement/sql/show_explain YES YES 9# We've got no instances 10select * from performance_schema.cond_instances where name like '%show_explain%'; 11NAME OBJECT_INSTANCE_BEGIN 12# Check out if our cond is hit. 13create table t0 (a int); 14insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); 15connect con1, localhost, root,,; 16connection con1; 17connection default; 18connection con1; 19set @show_explain_probe_select_id=1; 20SET @saved_dbug = @@SESSION.debug_dbug; 21SET debug_dbug='d,show_explain_probe_join_exec_start'; 22select count(*) from t0 where a < 100000; 23connection default; 24show explain for $thr2; 25id select_type table type possible_keys key key_len ref rows Extra 261 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where 27Warnings: 28Note 1003 select count(*) from t0 where a < 100000 29connection con1; 30count(*) 3110 32SET debug_dbug= @saved_dbug; 33select event_name 34from 35performance_schema.events_stages_history_long join 36performance_schema.threads using (thread_id) 37where 38event_name like '%show explain' and 39processlist_id=$thr1; 40event_name 41stage/sql/Show explain 42drop table t0; 43