explain.depesz.com

PostgreSQL's explain analyze made readable

Result: c3rtV

Settings
# exclusive inclusive rows x rows loops node
1. 0.495 4,041.155 ↑ 1.0 1 1

GroupAggregate (cost=0.06..16,005.56 rows=1 width=15) (actual time=4,041.155..4,041.155 rows=1 loops=1)

  • Group Key: d.code
2. 902.469 4,040.660 ↓ 282.0 282 1

Nested Loop Left Join (cost=0.06..16,005.55 rows=1 width=38) (actual time=15.894..4,040.660 rows=282 loops=1)

  • Join Filter: (p.order_id = o.id)
  • Rows Removed by Join Filter: 11,398,065
3. 0.283 22.655 ↓ 282.0 282 1

Nested Loop Left Join (cost=0.06..10,273.96 rows=1 width=29) (actual time=1.366..22.655 rows=282 loops=1)

  • Join Filter: (o.discount_id = d.code)
4. 0.013 0.013 ↑ 1.0 1 1

Index Scan using discounts_pkey on discounts d (cost=0.06..4.06 rows=1 width=22) (actual time=0.010..0.013 rows=1 loops=1)

  • Index Cond: (code = 'FOLLOW-UP'::text)
5. 22.359 22.359 ↑ 1.0 282 1

Seq Scan on orders o (cost=0.00..10,268.89 rows=289 width=19) (actual time=1.354..22.359 rows=282 loops=1)

  • Filter: (discount_id = 'FOLLOW-UP'::text)
  • Rows Removed by Filter: 95,693
6. 3,115.536 3,115.536 ↓ 1.0 40,419 282

Seq Scan on payments p (cost=0.00..5,591.32 rows=40,078 width=23) (actual time=0.002..11.048 rows=40,419 loops=282)

  • Filter: (status = 'successful'::payment_status)
  • Rows Removed by Filter: 3,501
Planning time : 0.340 ms
Execution time : 4,041.208 ms