Populate blocking issues count
Follow up of !42277 (merged) which has been reverted because failed to run in production.
Migration output
== 20201014142521 ScheduleSyncBlockingIssuesCount: migrating ==================
== 20201014142521 ScheduleSyncBlockingIssuesCount: migrated (0.0045s) =========
Scheduling queries
These queries are supported by temporary indexes introduced on !42277 (merged)
SELECT DISTINCT "issue_links"."source_id"
FROM "issue_links"
WHERE "issue_links"."link_type" = 1
AND "issue_links"."source_id" >= $1
AND "issue_links"."source_id" < $2
QUERY PLAN
Unique (cost=0.29..3.31 rows=1 width=4)
-> Index Only Scan using tmp_idx_blocking_type_links on issue_links (cost=0.29..3.31 rows=1 width=4)
Index Cond: ((source_id >= 10) AND (source_id < 1000))
SELECT DISTINCT "issue_links"."target_id"
FROM "issue_links"
WHERE "issue_links"."link_type" = 2
AND "issue_links"."source_id" >= $1
AND "issue_links"."source_id" < $2
QUERY PLAN
Unique (cost=3.46..3.46 rows=1 width=4)
-> Sort (cost=3.46..3.46 rows=1 width=4)
Sort Key: target_id
-> Index Scan using index_issue_links_on_source_id_and_target_id on issue_links (cost=0.42..3.
45 rows=1 width=4)
Index Cond: ((source_id >= 10) AND (source_id < 10000))
Filter: (link_type = 2)
related to #237977 (closed)