Details
-
New Feature
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
Is part of MDEV-38701
Description
include a scenario where in, given table is referenced both inside and outside of the stored function with in a sql query.
create table t1 ( |
a int, |
b int, |
index idx_ab(a, b) |
) ENGINE=InnoDB;
|
|
|
insert into t1 select seq%2, seq%3 from seq_1_to_20; |
delimiter //;
|
|
|
CREATE FUNCTION count_all(b_val INT) |
RETURNS INT |
READS SQL DATA
|
DETERMINISTIC
|
BEGIN
|
DECLARE a_cnt INT; |
SELECT COUNT(*) INTO a_cnt FROM t1 WHERE b = b_val; |
RETURN a_cnt; |
END
|
//
|
|
|
DELIMITER ;//
|
|
|
set optimizer_record_context=1; |
explain format=json select t1.a, t1.b, count_all(t1.b) from t1; |
|
|
-- capture the context
|
truncate table t1; |
set optimizer_replay_context='captured_context_var'; |
ensure that the cost metrics for the query would be same after the captured_context is replayed on the same query, even though the table is truncated.
Attachments
Issue Links
- relates to
-
MDEV-38701 Optimizer Trace Replay: Q1 2026 Dev Sprint Work 1
-
- In Testing
-
-
MDEV-27189 Optimizer Trace: save all info needed for replay
-
- Closed
-