Multiple Tags search query takes too long ? - big forum

Its a very big forum, around 0.5 million topics and 10 thousands tags, which are on each topic, 3-4 in number.
Multiple tags search query takes very very long time, how to fix this ?

Can you paste in the slow query using mini profiler

here is the complete miniprofiler details.
please see

I see. So in this example, it definitely is requiring each tag individually. I imagine the performance impact is the use of IN and then doing it 3 times (one for each tag).

I also wonder if the search can be smarter about this? Only use IN when multiple tags are provided, otherwise use =

If you alter your search to tags:wa,gastroenterology,female does it work better? Granted, it changes the query, as it won’t be topics that have all three, but topics that have any of the three.

Right now tags does not have a performant way to do AND and that is being requested at

ping @alehandrof, you might find this interesting


I’ll just throw in some food for thought here. It might be nice to have a URL structure to support searching by multiple tags.

This could be #wordpress AND #embedding

This could be #wordpress OR #embedding|embedding


Cool! I didn’t know you could do that. Thanks!

1 Like