Details
-
Bug
-
Status: In Review (View Workflow)
-
Minor
-
Resolution: Unresolved
-
13.0
-
None
-
Can result in unexpected behaviour
-
Q2/2026 Server Maintenance
Description
Bug found while testing MDEV-38045
Case:
--------
SELECT * FROM (SELECT a FROM t3) dt1, (SELECT b FROM t3) dt2; |
In QB_NAME path , 3rd select block can be referenced as
1)dt2
2)dt2@sel_1
3) @sel_3
Issue:
--------
3rd block referenced as dt2 or dt2@sel_1 , QB_NAME hint applied inside view (Refer: case1)
When referenced as @sel_3 , QB_NAME hint not applied( Refer: case2)
case1)
--------------
explain
|
SELECT /*+ no_index(t3@dt1) QB_NAME(dt1,dt2)*/ * FROM (SELECT a FROM t3) dt1, (SELECT b FROM t3) dt2; |
or
QB_NAME(dt1,dt2@sel_1)
|
or
create view v1 as |
SELECT /*+ no_index(t3@dt1) QB_NAME(dt1,dt2)*/ * FROM (SELECT a FROM t3) dt1, (SELECT b FROM t3) dt2; |
explain select * from v1; |
Expected and returned result same
+------+-------------+-------+-------+---------------+------+---------+------+------+------------------------------------+ |
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | |
+------+-------------+-------+-------+---------------+------+---------+------+------+------------------------------------+ |
| 1 | SIMPLE | t3 | index | NULL | a | 5 | NULL | 1 | Using index | |
| 1 | SIMPLE | t3 | ALL | NULL | NULL | NULL | NULL | 1 | Using join buffer (flat, BNL join) | |
+------+-------------+-------+-------+---------------+------+---------+------+------+------------------------------------+ |
case2)
--------------
SELECT /*+ no_index(t3@dt1) QB_NAME(dt1,@sel_3)*/ * FROM (SELECT a FROM t3) dt1, (SELECT b FROM t3) dt2; |
Returned: Expected (Same)
---------------
t3-index
t3-ALL (Hint applied here)
create view v1 as |
SELECT /*+ no_index(t3@dt1) QB_NAME(dt1,@sel_3)*/ * FROM (SELECT a FROM t3) dt1, (SELECT b FROM t3) dt2; |
explain select * from v1; |
Returned: Not expected( QB_NAME hint didn't apply)
---------------
t3- ALL (Hint applied here)
t3 -index
How to repro:
create table t3( a int,b int ,index(a),index(b)); |
Repeat case2)
|
Attachments
Issue Links
- relates to
-
MDEV-39349 NO_INDEX hint using QB_NAME doesn't work inside VIEWs
-
- Confirmed
-