Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
12.3
-
None
-
Unexpected results
-
Q2/2026 Server Maintenance
Description
Bug found while testing MDEV-38701
Replay should yield same execution plan as when context captured.
Case:
---------
No indexes in table while capturing context -->Does Table scan
Index created on table after capturing context
Issue:
--------
Replay on existing data-dir , differs in execution plan
If replay done on existing database , then create table stmt fails bcz table already exists.
It uses old table defination which has index , hence differs in execution plan
While Capturing context : Table scan choosen
+------+-------------+-------+------+---------------+------+---------+------+-------+-------+ |
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | |
+------+-------------+-------+------+---------------+------+---------+------+-------+-------+ |
| 1 | SIMPLE | t1 | ALL | NULL | NULL | NULL | NULL | 10000 | | |
+------+-------------+-------+------+---------------+------+---------+------+-------+-------+ |
Replay does : Index scan
+------+-------------+-------+-------+---------------+------+---------+------+-------+-------------+ |
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | |
+------+-------------+-------+-------+---------------+------+---------+------+-------+-------------+ |
| 1 | SIMPLE | t1 | index | NULL | i1 | 5 | NULL | 10000 | Using index | |
+------+-------------+-------+-------+---------------+------+---------+------+-------+-------------+ |
Note:
--------
Replay done on fresh data directory , then Execution plan is same
Steps to repro:
step1) Capture Context
|
----------------------------------
|
create database m8;use m8; |
create table t1( a int); |
insert into t1 select seq from seq_1_to_10000; |
set optimizer_record_context=ON; |
explain select * from t1; |
SELECT context INTO DUMPFILE 'context1.txt' FROM INFORMATION_SCHEMA.OPTIMIZER_CONTEXT; |
|
|
step2) Create index on table |
----------------------------
|
create index i1 on t1(a); |
|
|
step3) Execute Query |
----------
|
explain select * from t1; |
|
|
step4) Replay context
|
---------------------------------
|
source data2/m8/context1.txt;
|