我有这个疑问,其执行1或2秒为一个给定的情况:多加入或子查询的查询优化
Select Count(*) as qtty
From event e
Join org o On o.orgID = e.orgID
Join venue v On v.venueID = e.venueID
Where Match(e.name, e.description) Against ($keywords)
And e.site_id = $site_id
And e.display <> 0</code>
它计算的行建立分页。当我按事件类型过滤介绍(类型涉及多对多事件)查询开始服用没有少于45秒:
And Exists (
Select ete.id
From event_type_to_event ete
Where ete.event_id = e.eventID
And ete.event_type_id = $category)</code>
我也试图与event_type_to_event一个加入,但它更慢。
有什么建议吗?
注:解决。使用索引,查询执行时间缩短到不到一秒。
请贴EXPLAIN查询 – 2009-10-06 13:00:05