As soon as I’ve finished writing this post about “Using join cache”, it was apparent that “Using join cache” is poor wording. First, the corresponding server variable is called @@join_buffer_size, not join cache size, and second, there is really no cache involved.
We’ve had a discussion about how this should be called. Some sources use term Block nested-loops join but we’ve settled on “Using join buffer“. Another change is that we’ve decided to move the note one line down to the table that “does the buffering”. As a result, what was this
mysql> explain select * from t1, t2 where t1.col < 10 and t2.col < 'bar'; +----+-------------+-------+-------+-...-+-------------------------------+ | id | select_type | table | type | | Extra | +----+-------------+-------+-------+-...-+-------------------------------+ | 1 | SIMPLE | t1 | range | | Using where; Using join cache | | 1 | SIMPLE | t2 | range | | Using where | +----+-------------+-------+-------+-...-+-------------------------------+
became this:
mysql> explain select * from t1, t2 where t1.col < 10 and t2.col < 'bar'; +----+-------------+-------+-------+-...-+--------------------------------+ | id | select_type | table | type | | Extra | +----+-------------+-------+-------+-...-+--------------------------------+ | 1 | SIMPLE | t1 | range | | Using where | | 1 | SIMPLE | t2 | range | | Using where; Using join buffer | +----+-------------+-------+-------+-...-+--------------------------------+
The change was pushed into 5.1.19 tree. MySQL 5.1.18 is the only version that shows “Using join cache”. I’ve also updated the original explanation post to display the final variants of EXPLAIN output.
Thanks for writing all these articles. I really appreciate them. I’m going back through them for the third or fourth time trying to learn more!
LikeLike
Thank you. Glad to hear they are of use to somebody.
LikeLike