Tengo una query que tarda en ejecutarse 12segundos, y necesitaría saber donde se encuentra y que función puede realizar, pues ésta consulta logra tirarme al suelo mi servidor MySQL al tardar tanto, os pego la consulta completa, espero que me puedan ayudar.
Código:
Gracias! SELECT IF(votenum >= 1, votenum, 0) AS votenum, IF(votenum >= 1 AND votenum > 0, votetotal / votenum, 0) AS voteavg, post.pagetext AS preview, thread.threadid, thread.title AS threadtitle, thread.forumid, pollid, open, replycount, postusername, postuserid, thre ad.iconid AS threadiconid, thread.lastpost, thread.lastposter, thread.lastpostid, thread.dateline, IF(views<=replycount, replycount+1, views) AS views, notes, thread.visible, sticky, votetotal, thread.attach, hiddencount, deletedcount , NOT ISNULL(subscribethread.subscribethreadid) AS issubscribed FROM vbulletin_thread AS thread LEFT JOIN vbulletin_subscribethread AS subscribethread ON(subscribethread.threadid = thread.threadid AND subscribethr ead.userid = 2025 AND canview = 1) LEFT JOIN vbulletin_post AS post ON(post.postid = thread.firstpostid) WHERE thread.threadid IN (0,22416,35733,36273,31344,36088,36078,35950,35353,35942,35408,35857,3574 6,33191,35742,35666,23468,34 130,35470,35409,32159,35356,32180,35310,30824,35216,34674,34836,33463,347 83,34483,32919,31852,34588,33656,34498,19911,34530,31700,33896,34200, 4947,30764) ORDER BY sticky DESC, lastpost DESC;