ezsystems/ezpublish-kernel — pull request #894 by joaoinacio (2014-06-18 18:57:53+00:00)
Title: Fix EZP-23037: multiple JOINs in Subtree criterion

JIRA: https://jira.ez.no/browse/EZP-23037

Problem:
Subtree criterion is used in content search for user roles/permissions in policy and role assignment subtree limitations.
Given enough limitations, this will cause many JOIN clauses on simple content searches.
Depending on conditions, the above can cause severe performance degradation leading to MySQL timeouts (queries not finishing).

This PR replaces the unique table name join with a single join with the contentobject_tree table in the Subtree criterion, by looking at the existing query aliases.