explain.depesz.com

PostgreSQL's explain analyze made readable

Result: NMq3

Settings
# exclusive inclusive rows x rows loops node
1. 62.715 122,770.647 ↑ 1.0 1 1

Aggregate (cost=359,838,819.60..359,838,819.61 rows=1 width=8) (actual time=122,770.647..122,770.647 rows=1 loops=1)

  • JIT:
  • Functions: 41
  • Options: Inlining true, Optimization true, Expressions true, Deforming true
  • Timing: Generation 3.114 ms, Inlining 6.774 ms, Optimization 192.402 ms, Emission 115.656 ms, Total 317.946 ms
2. 147.791 122,707.932 ↑ 2.2 971,129 1

Hash Join (cost=1,120,492.16..359,833,566.96 rows=2,101,055 width=0) (actual time=46,253.469..122,707.932 rows=971,129 loops=1)

  • Hash Cond: (orders.project_id = projects.id)
3. 87.919 122,243.428 ↑ 2.7 971,129 1

Nested Loop (cost=1,120,455.42..359,826,563.14 rows=2,629,253 width=4) (actual time=45,936.747..122,243.428 rows=971,129 loops=1)

4. 0.015 0.033 ↑ 1.5 2 1

Hash Join (cost=1.06..2.15 rows=3 width=4) (actual time=0.022..0.033 rows=2 loops=1)

  • Hash Cond: (campaigns.advertiser_id = advertiser.id)
5. 0.009 0.009 ↑ 1.0 5 1

Seq Scan on campaigns (cost=0.00..1.05 rows=5 width=8) (actual time=0.005..0.009 rows=5 loops=1)

6. 0.002 0.009 ↑ 2.0 1 1

Hash (cost=1.04..1.04 rows=2 width=4) (actual time=0.009..0.009 rows=1 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
7. 0.007 0.007 ↑ 2.0 1 1

Seq Scan on advertiser (cost=0.00..1.04 rows=2 width=4) (actual time=0.007..0.007 rows=1 loops=1)

  • Filter: (network_id = ANY ('{1,-1}'::integer[]))
  • Rows Removed by Filter: 2
8. 65,302.375 122,155.476 ↑ 1.6 485,564 2

Bitmap Heap Scan on orders (cost=1,120,454.36..119,934,299.24 rows=788,776 width=12) (actual time=22,968.345..61,077.738 rows=485,564 loops=2)

  • Recheck Cond: ((campaign_id = campaigns.id) AND (status >= 0))
  • Filter: (((SubPlan 1) >= '2020-07-01 00:00:00+02'::timestamp with time zone) AND ((SubPlan 2) <= '2020-07-10 23:59:59+02'::timestamp with time zone))
  • Rows Removed by Filter: 10,831,526
  • Heap Blocks: exact=2,140,870
9. 97.634 33,247.790 ↓ 0.0 0 2

BitmapAnd (cost=1,120,454.36..1,120,454.36 rows=7,098,982 width=0) (actual time=16,623.895..16,623.895 rows=0 loops=2)

10. 8,320.070 8,320.070 ↓ 1.9 13,906,201 2

Bitmap Index Scan on orders_campaign_id_idx (cost=0.00..160,412.87 rows=7,230,334 width=0) (actual time=4,160.035..4,160.035 rows=13,906,201 loops=2)

  • Index Cond: (campaign_id = campaigns.id)
11. 24,830.086 24,830.086 ↓ 1.1 38,758,824 2

Bitmap Index Scan on orders_project_id_status_idx (cost=0.00..958,858.07 rows=35,494,912 width=0) (actual time=12,415.043..12,415.043 rows=38,758,824 loops=2)

  • Index Cond: (status >= 0)
12.          

SubPlan (for Bitmap Heap Scan)

13. 22,634.182 22,634.182 ↑ 1.0 1 22,634,182

Index Scan using events_pkey on events (cost=0.14..8.16 rows=1 width=8) (actual time=0.000..0.001 rows=1 loops=22,634,182)

  • Index Cond: (id = orders.salary_id)
14. 971.129 971.129 ↑ 1.0 1 971,129

Index Scan using events_pkey on events events_1 (cost=0.14..8.16 rows=1 width=8) (actual time=0.000..0.001 rows=1 loops=971,129)

  • Index Cond: (id = orders.salary_id)
15. 316.624 316.713 ↓ 1.0 360 1

Hash (cost=32.26..32.26 rows=358 width=4) (actual time=316.713..316.713 rows=360 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 21kB
16. 0.089 0.089 ↓ 1.0 360 1

Index Only Scan using projects_id_idx on projects (cost=0.15..32.26 rows=358 width=4) (actual time=0.013..0.089 rows=360 loops=1)

  • Heap Fetches: 282
Planning time : 0.717 ms
Execution time : 122,788.402 ms