The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
![]()
I need help with optimizing queries with indexes.
I try my best but whatever combinations I try the query is slow. Here is an example query: Code:
SELECT COUNT(nzb.threadid) as threads FROM thread as thread LEFT JOIN nzb as nzb ON nzb.threadid=thread.threadid WHERE thread.forumid IN (80,120,106,108,107) AND sticky = 0 AND visible IN (0,1,2) Code:
SELECT COUNT(nzb.threadid) as threads FROM thread as thread LEFT JOIN nzb as nzb ON nzb.threadid=thread.threadid WHERE thread.forumid IN (80,120,106,108,107) AND sticky = 0 AND visible IN (0,1,2) AND thread.iconid IN(30,34,36,67,73,99,100,102,104,75,76,78,97,98,107,106,33) Anyway what's the recommended indexes keeping in mind this query ^. Thanks a lot for any help you can give me. ![]() |
#2
|
||||
|
||||
![]()
Hm, isn't the thread count stored in the forum cache array?
Why not build a foreach, using $vbulletin->forumcache? |
#3
|
||||
|
||||
![]()
It's counting threads that meet a certain condition.
This is the same thing forumdisplay does only I've added the 'nzb' table and am limiting to certain iconids (I use them as categories in this script). |
#4
|
||||
|
||||
![]()
I don't know if this applies to Mysql but when it comes to oracle, the where ... in clause doesn't use the index.
|
#5
|
||||
|
||||
![]() Quote:
That could just be my problem then, thanks for that tip I'll try something keeping that in mind when I get a chance... |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|