MySQL myisam table, temporary table and index
Would it be faster to add in开发者_Go百科dex for "t.name"? Does the index for "t.name" is preserved when the temporary table "x" is created?
SELECT x.id
FROM
(SELECT t.name FROM t WHERE id_group=1 LIMIT 2000) AS x
WHERE x.name LIKE 'a%' LIMIT 0,12
in general when you do simple like on query statement on some column, this column should be an index, except some other cases
in this case i presume x.name is ordinary varchar 255 so you definately should do it
精彩评论