这是一个有效的MYSQL查询?

时间:2017-01-19 17:56:04

标签: mysql

我正在使用vbulletin 5并从主机收到MYSQL Query被杀的消息,因为它运行超过1分钟..我查看了查询并觉得它有问题..虽然我没有有足够的经验判断 这是查询..

SELECT DISTINCT node.starter AS nodeid
  FROM node as node
    JOIN closure AS closure ON node.nodeid = closure.child 
    LEFT JOIN node AS starter 
      ON starter.nodeid = IF(node.starter = 0, node.nodeid, node.starter)

  WHERE node.contenttypeid <> 19 
    AND node.contenttypeid IN ('22','26','23','21','20','25') 
    AND closure.parent = '2' 
    AND node.nodeid <> closure.parent 
    AND node.contenttypeid <> '15' 
    AND node.userid <> '28030'
    AND (node.public_preview = 1 
      OR 
        ( 
          ( 
            ( 
              (
                starter.parentid IN (1,2,3,6,13,14,15,16,17,18,19,20,21,22,23,24,25,26,247197,257065,7,8,9,12,51,59,62,27,32,33,36,44,45,50,35,34,37,38,39,40,61,60,57,43,42,46,47,28,29,30,31,41,48,49,52,53,54,55,56,58,63,65,64,247199,247200,66) 
              ) 
              AND node.showapproved > 0 
              AND node.viewperms > 1 
              AND node.showpublished > 0 
            )
          )
        OR starter.parentid = 9 AND node.userid IN (0)
      )
    )

  ORDER BY node.lastcontent DESC,node.nodeid ASC
  LIMIT 500

0 个答案:

没有答案