MYSQL:如何加快查询速度?

时间:2017-03-22 15:13:23

标签: mysql

如何加快此查询?

SELECT 'form_registry_pages'.'id', 'form_registry_pages'.'number', 'form_registry'.'pretag'
FROM 'form_registry_pages', 'form_registry'
WHERE 'form_registry'.'id' = 'form_registry_pages'.'form_registry_id'
AND 'form_registry'.'start_date' != '0000-00-00' AND 'form_registry'.'finish_date' != '0000-00-00'
AND (

   (SELECT 'to_id'
   FROM 'form_registry_pages_pos'
   WHERE 'page_id' = 'form_registry_pages'.'id' AND 'to_type' = '1'
   ORDER BY 'time' DESC
   LIMIT 0,1) IN (80)
   OR
   (SELECT 'to_id'
   FROM 'form_registry_pages_pos'
   WHERE 'page_id' = 'form_registry_pages'.'id' AND 'to_type' = '2'
   ORDER BY 'time' DESC
   LIMIT 0,1) IN (6,41)
   )
   AND (SELECT COUNT(*)
   FROM 'form_registry_pages_assigns'
   WHERE 'page_id' = 'form_registry_pages'.'id') = 0;

它有点慢,我需要加快一点。你有什么建议吗?

0 个答案:

没有答案