【发布时间】:2014-11-12 16:37:45
【问题描述】:
我有以下慢查询。 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
对如何改进查询有何建议?
【问题讨论】:
-
在不知道自己在做什么或者是否需要表格的所有行的情况下,您的问题没有正确答案。
-
@adamdehaven,我需要这三个表中的所有列。
-
对不起,我认为“Mysql 中的慢查询”是事实陈述,而不是问题:>
-
“慢”有多慢?每个表中有 100 万行,这不会是瞬时的。
-
@DonLi - 您的问题无法深入了解存在多少列等。
标签: jquery mysql sql performance