Skip to content

Instantly share code, notes, and snippets.

@dgouyette
Created February 15, 2011 15:17
Show Gist options
  • Save dgouyette/827634 to your computer and use it in GitHub Desktop.
Save dgouyette/827634 to your computer and use it in GitHub Desktop.
explain et index
//Affiche les index positionnés sur ma table
SHOW INDEX FROM MA_TABLE
SELECT
*
FROM
tblA,
tblB,
tblC
WHERE
tblA.col1 = tblB.col1
AND tblA.col2 = tblC.col1;
And EXPLAIN for the query:
+-------+------+---------------+------+---------+------+------+-------------+
| table | type | possible_keys | key | key_len | ref | rows | Extra |
+-------+------+---------------+------+---------+------+------+-------------+
| tblA | ALL | NULL | NULL | NULL | NULL | 1000 | |
| tblB | ALL | NULL | NULL | NULL | NULL | 1000 | Using where |
| tblC | ALL | NULL | NULL | NULL | NULL | 1000 | Using where |
+-------+------+---------------+------+---------+------+------+-------------+
see http://hackmysql.com/case4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment