I have a situation when one model has two different context for tags and those are used in a search filtering system. When im searching for 10+ tags with #tagged_with(tags, :on => :context), the amount of joins done (one join for each tag) makes the query close to unexecutable. I literally cannot even get an explain output with mysql for the query. Oddly enough, when im cutting the joins to like below 10, it works fast. Anyone experienced this or has an idea how to solve it?
I'm facing the same issue. Your pull request did seem to improve the performance, but even so ActiveRecord takes a lot of time to return anything.
@mogelbrod are you able to paste a SQL EXPLAIN showing where the slowdown is?