vBulletin Mods

The Official vBulletin Modifications Site

Query optimization request
by jscieza
23 Jan 2011 19:42


My programmer gave me the following query to get the latest 10 threads created on my forum to be listed in the sidebar of my forumhome (I'm using vB 3.8.x). Issue here is that the query is being listed as slow query (and a very slow one). Please take a look:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

How I can optimize that query?

Thank you,

kh99 23 Jan 2011 20:15

I'm not an SQL expert or anything, but that looks pretty much like the same query that forumdisplay.php does except that, in forumdisplay it only does the deletionlog join if the user can see deletion notices. I think the same info about if the thread has been deleted or not is in the visible field (or maybe the open field).

So, assuming you never want deletion notices showing on your main page, you could try deleting the "LEFT JOIN" line and the "AND deletionlog" line and see how that works.

Amenadiel 26 Jan 2011 03:37

you can ignore the left join. As long as you check for visible=1 you'll be already dismissing deleted threads.

along with the left join you should then remove the sentence "AND deletionlog.primaryid IS NULL"

All times are GMT. The time now is 02:15.

Powered by vBulletin® Version 3.8.13
Copyright © 2019, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.