Description:
In the optimization process and the optimizer trace, the name of a query block is
represented by "select#" followed by a **decimal** select_number. However, in the
hint, the name of the query block is represented by "select#" followed by a
hexadecimal select_number. This can easily lead to misusage.
How to repeat:
> create table t1 (a int, b int);
> explain select * from(select * from(select * from(select * from(select * from(select * from(select * from(select * from(select * from(select * from(select * from(select * from(select * from(select * from(select * from (select /*+BNL()*/ max(tt1.a), tt2.b as bb from t1 tt1, t1 tt2 group by bb) a)b)c)d)e)f)g)h)i)j)k)l)m)n)o\G
...
> show warnings\G
*************************** 1. row ***************************
Level: Note
Code: 1003
Message: /* select#1 */ select /*+ BNL(@`select#10`) */ `a`.`max(tt1.a)` AS `max(tt1.a)`,`a`.`bb` AS `bb` from (/* select#16 */ select max(`test`.`tt1`.`a`) AS `max(tt1.a)`,`test`.`tt2`.`b` AS `bb` from `test`.`t1` `tt1` join `test`.`t1` `tt2` group by `bb`) `a`
In this example, both @`select#10` and select#16 refer to the 16th query block, but the value used in the hint is the hexadecimal representation of 16. This inconsistent display method is likely to cause confusion and, when using hints, also prone to specifying the wrong query block.
Suggested fix:
Unify the display of query block names into decimal format.