MariaDB [test]> SELECT table1 .`col_int_nokey` FROM D table1 STRAIGHT_JOIN ( D JOIN ( D table3 STRAIGHT_JOIN D table4 ON table4 .`pk` = table3 .`col_varchar_key` ) ON table4 .`pk` ) ON table4 .`col_varchar_key`;
Empty set (7.94 sec)
MariaDB [test]> SELECT table1 .`col_int_nokey` FROM D table1 STRAIGHT_JOIN ( D JOIN ( D table3 STRAIGHT_JOIN D table4 ON table4 .`pk` = table3 .`col_varchar_key` ) ON table4 .`pk` ) ON table4 .`col_varchar_key`;
Empty set (1.62 sec)
I failed to reproduce this bug with the latest 5.3 tree
I got with a debug build:
MariaDB [test]> set join_cache_level=8;
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]> set optimizer_ switch= 'mrr=on' ;
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]> SELECT table1 .`col_int_nokey` FROM D table1 STRAIGHT_JOIN ( D JOIN ( D table3 STRAIGHT_JOIN D table4 ON table4 .`pk` = table3 .`col_varchar_key` ) ON table4 .`pk` ) ON table4 .`col_varchar_key`;
Empty set (7.94 sec)
and
MariaDB [test]> set join_cache_level=8;
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]> set optimizer_ switch= 'mrr=on, mrr_sort_ keys=on' ;
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]> SELECT table1 .`col_int_nokey` FROM D table1 STRAIGHT_JOIN ( D JOIN ( D table3 STRAIGHT_JOIN D table4 ON table4 .`pk` = table3 .`col_varchar_key` ) ON table4 .`pk` ) ON table4 .`col_varchar_key`;
Empty set (1.62 sec)