This query was performing badly. The solution seems to be to add a
redundant JOIN and WHERE to the subquery.
I renamed the table aliases in the subquery to avoid name collisions
elsewhere. I am afraid that makes the diff rather unhelpful. The
AND subq_qu.component = :qubacomponent2
line is new. The other lines have just had subq_ added.