-> Nested Loop Left Join (cost=43387.94..702110.46 rows=20168 width=288) Filter: ((public.bugtask.product IS NULL) OR public.product.active) -> Nested Loop (cost=43387.94..695244.24 rows=22125 width=280) -> Bitmap Heap Scan on bug (cost=43387.94..614073.75 rows=22125 width=4) Recheck Cond: (duplicateof IS NULL) Filter: ((latest_patch_uploaded IS NOT NULL) AND (NOT private)) -> Bitmap Index Scan on bug_duplicateof_idx (cost=0.00..43382.41 rows=577824 width=0) Index Cond: (duplicateof IS NULL) -> Index Scan using bugtask__bug__idx on bugtask (cost=0.00..3.66 rows=1 width=280) Index Cond: (public.bugtask.bug = public.bug.id) Filter: ((public.bugtask.status = 10) OR (public.bugtask.status = 15) OR (public.bugtask.status = 20) OR (public.bugtask.status = 21) OR (public.bugtask.status = 22) OR (public.bugtask.status = 25)) -> Index Scan using product_pkey on product (cost=0.00..0.30 rows=1 width=9) Index Cond: (public.bugtask.product = public.product.id) Filter: public.product.active
is the core of the slowness