Multiple Tags search query takes too long ? - big forum

(Veer) #1

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 ?

(Sam Saffron) #2

Can you paste in the slow query using mini profiler

(Veer) #5

here is the complete miniprofiler details.
please see

(cpradio) #6

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

(Clay Heaton) #7

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
(Rafael dos Santos Silva) #8

(Clay Heaton) #9

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

(system) automatically bumped #10
(Joffrey Jaffeux) closed #11