Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
Description
Issue seen in main.group_min_max_innodb
Trace output:
------------------------
Capture : trace1.txt
replay : trace2.txt![]()
Capture Explain:
-----------
+------+-------------+------------+-------+---------------+------+---------+---------+------+-----------------------------------------------------------+ |
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | |
+------+-------------+------------+-------+---------------+------+---------+---------+------+-----------------------------------------------------------+ |
| 1 | PRIMARY | t1 | ALL | NULL | NULL | NULL | NULL | 4 | Using where | |
| 1 | PRIMARY | <derived2> | ref | key0 | key0 | 6 | m8.t1.b | 1 | | |
| 2 | DERIVED | t2 | range | a | a | 58 | NULL | 7 | Using index for group-by; Using temporary; Using filesort | |
+------+-------------+------------+-------+---------------+------+---------+---------+------+-----------------------------------------------------------+ |
Replay Explain:
----------------
+------+-------------+------------+-------+---------------+------+---------+---------+------+-----------------------------------------------------------+ |
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | |
+------+-------------+------------+-------+---------------+------+---------+---------+------+-----------------------------------------------------------+ |
| 1 | PRIMARY | t1 | ALL | NULL | NULL | NULL | NULL | 4 | Using where | |
| 1 | PRIMARY | <derived2> | ref | key0 | key0 | 6 | m8.t1.b | 1 | | |
| 2 | DERIVED | t2 | range | NULL | a | 58 | NULL | 1 | Using index for group-by; Using temporary; Using filesort | |
+------+-------------+------------+-------+---------------+------+---------+---------+------+-----------------------------------------------------------+ |
|
How to repro:
----------------
set optimizer_record_context=ON; |
|
|
CREATE TABLE t1 (a varchar(35), b varchar(4)) ENGINE=InnoDB CHARSET=latin1; |
INSERT INTO t1 VALUES |
('Albania','AXA'),('Australia','AUS'),('American Samoa','AMSA'),('Bahamas','BS'); |
|
|
CREATE TABLE t2 (a varchar(4), b varchar(50), PRIMARY KEY (b,a), KEY (a)) ENGINE=InnoDB CHARSET=latin1; |
INSERT INTO t2 VALUES |
('BERM','African Methodist Episcopal'),('AUS','Anglican'),('BERM','Anglican'),('BS','Anglican'),('BS','Baptist'),('BS','Methodist'); |
|
|
explain SELECT t1.a |
FROM (SELECT a FROM t2 GROUP BY a ORDER BY COUNT(DISTINCT b) LIMIT 1) dt |
JOIN t1 ON dt.a=t1.b; |
|
|
SELECT context INTO DUMPFILE 'context1.txt' FROM INFORMATION_SCHEMA.OPTIMIZER_CONTEXT; |
source context1.txt
|
Attachments
Issue Links
- relates to
-
MDEV-39368 Add mtr --replay-server option to test Optimizer Context Replay
-
- In Progress
-