HashAggregate (cost=857902.44..857922.33 rows=1137 width=8) (actual time=117884.130..117884.748 rows=347 loops=1)
Filter: (count(*) > 0)
-> Merge Left Join (cost=851326.25..855750.06 rows=286983 width=8) (actual time=117864.712..117881.142 rows=1498 loops=1)
Merge Cond: ((uf.feeder_id = fs.feeder_id) AND (fi.id = fs.item_id))
Filter: (NOT CASE WHEN (fs.status IS NULL) THEN (fi.pub_date < COALESCE(f.horizont_date, '1981-01-01 00:00:00+00'::timestamp with time zone)) ELSE (fs.status = 1) END)
-> Sort (cost=849966.12..851401.04 rows=573966 width=40) (actual time=117765.294..117770.588 rows=4814 loops=1)
Sort Key: uf.feeder_id, fi.id
Sort Method: quicksort Memory: 467kB
-> Hash Join (cost=461568.34..763669.54 rows=573966 width=40) (actual time=86584.199..117741.915 rows=4814 loops=1)
Hash Cond: (uf.feed_id = fi.feed_id)
-> Hash Join (cost=4677.90..6517.40 rows=1137 width=40) (actual time=56.363..64.782 rows=1192 loops=1)
Hash Cond: (uf.feed_id = f.id)
-> Bitmap Heap Scan on ext_feeder_user_feed uf (cost=4152.71..5965.21 rows=1137 width=24) (actual time=15.457..17.221 rows=1192 loops=1)
Recheck Cond: (id = ANY ('{1531,...~1000 штук...,119901}'::bigint[]))
-> Bitmap Index Scan on ext_feeder_user_feed_pkey (cost=0.00..4152.43 rows=1137 width=0) (actual time=15.434..15.434 rows=1192 loops=1)
Index Cond: (id = ANY ('{1531,...~1000 штук...,119901}'::bigint[]))
-> Hash (cost=407.86..407.86 rows=9386 width=16) (actual time=40.869..40.869 rows=9386 loops=1)
-> Seq Scan on ext_feeder_feed f (cost=0.00..407.86 rows=9386 width=16) (actual time=0.017..22.830 rows=9386 loops=1)
-> Hash (cost=396938.42..396938.42 rows=3265442 width=24) (actual time=86109.247..86109.247 rows=3282823 loops=1)
-> Seq Scan on ext_feeder_item fi (cost=0.00..396938.42 rows=3265442 width=24) (actual time=0.049..76679.642 rows=3282823 loops=1)
-> Sort (cost=1360.13..1399.81 rows=15872 width=20) (actual time=87.817..93.294 rows=5367 loops=1)
Sort Key: fs.feeder_id, fs.item_id
Sort Method: quicksort Memory: 877kB
-> Seq Scan on ext_feeder_item_status fs (cost=0.00..252.72 rows=15872 width=20) (actual time=2.782..41.988 rows=15872 loops=1)
Total runtime: 117904.944 ms