Slow bulk issue updates
Attempting to update a large number (~800k) issues at once creates extremely slow queries.
The problematic query that caused a slowdown today had the following form
UPDATE "issues_issue" SET "status" = 1 WHERE "issues_issue"."id" IN (SELECT DISTINCT U0."id" FROM "issues_issue" U0 INNER JOIN "projects_project" U1 ON (U0."project_id" = U1."id") INNER JOIN "organizations_ext_organization" U2 ON (U1."organization_id" = U2."id") INNER JOIN "organizations_ext_organizationuser" U3 ON (U2."id" = U3."organization_id") WHERE (U3."user_id" = {user-id} AND U2."slug" = {org-slug} AND U0."status" = 0 AND U0."search_vector" @@ (plainto_tsquery({error})) AND U0."project_id" = {id}))