Skip to content

Instantly share code, notes, and snippets.

@spetrunia
Created January 9, 2013 14:36
Show Gist options
  • Save spetrunia/4493592 to your computer and use it in GitHub Desktop.
Save spetrunia/4493592 to your computer and use it in GitHub Desktop.
MariaDB [test]> EXPLAIN SELECT *
-> FROM t1a LEFT JOIN t2a ON (b1 = a2)
-> WHERE (b1, b1) IN (SELECT a3, b3 FROM t3a);
+------+--------------+-------------+------+---------------+------+---------+-------------+------+-------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+--------------+-------------+------+---------------+------+---------+-------------+------+-------------------------------------------------+
| 1 | PRIMARY | <subquery2> | ALL | distinct_key | NULL | NULL | NULL | 3 | |
| 1 | PRIMARY | t1a | ref | b1 | b1 | 2 | test.t3a.a3 | 1 | Using index |
| 1 | PRIMARY | t2a | ALL | NULL | NULL | NULL | NULL | 3 | Using where; Using join buffer (flat, BNL join) |
| 2 | MATERIALIZED | t3a | ALL | NULL | NULL | NULL | NULL | 3 | Using where |
+------+--------------+-------------+------+---------------+------+---------+-------------+------+-------------------------------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment