I have a query similar to following with more conditions and joins in the sub query.
EXPLAIN SELECT * FROM (SELECT * FROM test WHERE id = 1) as drv
Subquery alone takes 1sec, because of derived table above query takes 2.5 sec. How can i define index on the derived table. Apart from creating temporary table is there any way to define index. My query is complex enough that it has more joins and conditions on top of the above query that is why i don't want to go for temporary tables..And i feel there must be some way to define indexes apart from temporary tables