I'm supposed to be working on subquery optimization but I can't get BUG#26630 out of my head.
The bug test case is small and easy to understand: looking at the EXPLAIN:
CREATE TABLE tbl_test( ... ) partition BY range(num) (...); EXPLAIN partitions SELECT * FROM tbl_co c STRAIGHT_JOIN tbl_test t WHERE t.num=c.num AND reg=8;
..+-------+-------------+------+---------------+------+---------+------+------+-------------+ | table | partitions | type | possible_keys | key | key_len | ref | rows | Extra | ..+-------+-------------+------+---------------+------+---------+------+------+-------------+ | c | NULL | ALL | NULL | NULL | NULL | NULL | 17 | Using where | | t | p0,p1,p2,p3 | ALL | NULL | NULL | NULL | NULL | 17 | Using where | ..+-------+-------------+------+---------------+------+---------+------+------+-------------+ …[Read more]