tags:

views:

34

answers:

1

Would it be faster to add index 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
A: 

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

nabizan