在Mysql中查询速度慢

时间:2014-11-12 16:37:46

标签: jquery mysql sql performance

我有以下慢查询。 cid和date都是每个表中的索引。每个表中有1M行。我需要这三个表中的所有列

 select * from 
    (SELECT * FROM `table1` where `cid` =? order by date desc limit 0, 10) as a 
        left join ( SELECT * FROM `table2` where `cid?` =?) as b on a.date=b.date? 
        left join (SELECT * FROM `table3` where `cid` =? ) as c on a.date=c.date? 
        order by date asc

有关如何改进查询的任何建议吗?

1 个答案:

答案 0 :(得分:0)

在所有表上为字段CID和日期

创建单独的索引