Once the query reached a certain number of joins, Postgres would (apparently) do all the joins for every work in the database, then apply the WHERE filter after the fact.
This change explicitly filters the works in a subquery before joining anything to it, so Postgres doesn't have the power to make such bad life choices.
Coverage remained the same at 78.648% when pulling 79a199e2b022a3f07c3b90dd0d0ba374f3fe7f58 on aaxelb:fix/SHARE-1000--how-about-not-slowly into 737ee1d248ac8fdec2804dc862a0252f7185db85 on CenterForOpenScience:develop.
Once the query reached a certain number of joins, Postgres would (apparently) do all the joins for every work in the database, then apply the
WHERE
filter after the fact.This change explicitly filters the works in a subquery before joining anything to it, so Postgres doesn't have the power to make such bad life choices.