explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 5HPa

Settings
# exclusive inclusive rows x rows loops node
1. 0.050 13,231.471 ↑ 1.0 100 1

Limit (cost=1,364,389.10..1,364,420.97 rows=100 width=469) (actual time=10,970.012..13,231.471 rows=100 loops=1)

2. 71.067 13,231.421 ↑ 86,347.0 100 1

Merge Join (cost=1,364,389.10..4,116,512.07 rows=8,634,702 width=469) (actual time=10,970.012..13,231.421 rows=100 loops=1)

  • Merge Cond: (events.case_file_id = evs.case_file_id)
3. 82.273 10,897.468 ↑ 109,921.7 3 1

GroupAggregate (cost=1,364,388.66..1,401,487.18 rows=329,765 width=20) (actual time=10,742.370..10,897.468 rows=3 loops=1)

  • Group Key: events.case_file_id, events.service_name
  • Filter: (max(events.updated_at) > '2019-11-01 00:00:00'::timestamp without time zone)
  • Rows Removed by Filter: 19355
4. 3,775.097 10,815.195 ↑ 12.8 257,839 1

Sort (cost=1,364,388.66..1,372,632.78 rows=3,297,645 width=20) (actual time=10,711.523..10,815.195 rows=257,839 loops=1)

  • Sort Key: events.case_file_id, events.service_name
  • Sort Method: external merge Disk: 110632kB
5. 7,040.098 7,040.098 ↓ 1.0 3,329,463 1

Seq Scan on events (cost=0.00..872,108.05 rows=3,297,645 width=20) (actual time=0.008..7,040.098 rows=3,329,463 loops=1)

  • Filter: ((service_name)::text = 'mailjet'::text)
  • Rows Removed by Filter: 2676070
6. 144.390 2,262.886 ↑ 9.7 257,817 1

Materialize (cost=0.43..2,458,115.82 rows=2,501,620 width=469) (actual time=0.113..2,262.886 rows=257,817 loops=1)

7. 2,118.496 2,118.496 ↑ 9.7 257,817 1

Index Scan using index_events_on_case_file_id on events evs (cost=0.43..2,451,861.77 rows=2,501,620 width=469) (actual time=0.109..2,118.496 rows=257,817 loops=1)

  • Filter: ((request_body ~~ '{%%}'::text) AND ((service_name)::text = 'mailjet'::text))
  • Rows Removed by Filter: 224954
Planning time : 0.416 ms
Execution time : 13,254.126 ms