Views many to one filter subqueries

Categories

Component ID

2656262

Component name

Views many to one filter subqueries

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

If you filter a view by a 'many to one' field, like for example any term reference field, and dare to filter by multiple values ANDed together, then the views query produced can have many, many, many joins.

MySQL can choke on this, badly. A small production site with a small set of tables produced DB queries that took over 3 days to execute!

Instead, we change the query added from being lots and lots of joins, to instead a single subquery condition.

This will work for small datasets and probably not for larger ones.

If you really need to search a large dataset for specific data, the your best bet is probably to pop it into something that can do searching, rather than using views.