Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Run this as .test testcase:
CREATE TABLE t1 (a INT, b INT, KEY(a));
|
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
|
|
|
# Note: this is essential: without it, the context is present:
|
analyze table t1;
|
|
|
create function add1(i int) returns int deterministic
|
return i+1;
|
|
|
set optimizer_record_context=1;
|
explain select * from t1 where b< add1(3);
|
select * from information_schema.optimizer_context;
|
|
|
drop function add1;
|
DROP TABLE t1;
|
and observe this:
explain select * from t1 where b< add1(3);
|
id select_type table type possible_keys key key_len ref rows Extra
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
|
select * from information_schema.optimizer_context;
|
QUERY CONTEXT
|
drop function add1;
|
DROP TABLE t1;
|
There is nothing in the context, because we take this if in store_optimizer_context():
if (!thd->opt_ctx_recorder || |
lex->query_tables == *(lex->query_tables_last))
|
{
|
return false; |
}
|
lex->query_tables points to t1,
lex->query_tables_last points to somewhere where there is a pointer to t1.
Attachments
Issue Links
- relates to
-
MDEV-39368 Add mtr option to test Optimizer Context Replay
-
- Open
-