Jump to content

SQL performance-optimization suggestion


WebCMS

Recommended Posts

If there are say more than 100 subforums and the user selects all of them except a couple of them (in the Fluid View Filter Checkboxes widget) which s/he is not interested in viewing their topics, it would be more performant to count the number of forums and number of checked boxes:

If the number of checked boxes is greater than the number of unchecked boxes then

    WHERE forumId NOT IN (x,y,x)   // Just address the unchecked forumIds to minimize the number of IN clauses

//  as opposed to - WHERE forumId IN (97 subforums IDs)

else

    WHERE forumId IN (a,b,c,d,e,f...)

end if

 

HTH

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...