- Baron Schwartz presents
- only works for SELECTs
- nobody dares admit if they've never seen EXPLAIN
- MySQL actually executes the query
- at each JOIN, instead of executing the query, it fills the EXPLAIN result set
- everything is a JOIN (even SELECT 1)
-
Columns in EXPLAIN
- id: which SELECT the row belongs to
- select_type
- simple
- subquery
- derived
- union
- union result
- table: the table accessed or its alias
- type:
- join
- range
- …
- possible_keys: which indexes looked useful to the …
I'll be attending the 2008 MySQL Conference and Expo again this year, and I'm looking forward to hearing some great sessions, meeting new and old friends, and giving sessions myself. As a proposal reviewer, I looked at and voted on 250+ proposals for sessions and tutorials for this conference. There are going to be some great sessions and tutorials.
The “sla” in mysqlsla stands for “statement log analyzer”. This does a much better job than mysqldumpslow of analyzing your slow query log. In fact, you can sort by many different parameters — by sheer number of times the query shows up in the slow query log, by the total or average query [...]
Today I’ve been checking out a new client environment. My mission is to figure out (cold) some of the characteristics of the queries being run, and particularly if they’re “good” or “bad”. In my arsenal of “tools I really want to check out” has been Ma’atkit’s Query Profiler. They’re very different tools. Ma’atkit’s query [...]
If you've ever wished you could see MySQL's EXPLAIN output formatted as a tree, now you can. MySQL Visual Explain transforms EXPLAIN output into a hierarchical view of the query plan, which is significantly easier to read and understand.
Is your MySQL server doing an extra index scan on queries that need to check a key for matches or NULL? It's easy for this to happen accidentally, but it's also easy to fix, especially in MySQL 5.0 and up. Here's how.
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 | …[Read more]
UPDATE:
* s/Using join cache/Using join buffer/, changed to show the
final variants of EXPLAIN output as described here
* s/join_buff_size/join_buffer_size/
Starting from 5.1.18, EXPLAIN output may show "Using join
cache", like in this example:
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 join cache is actually not a new feature. It has been …
[Read more]