explain.depesz.com

PostgreSQL's explain analyze made readable

Result: rIKg

Settings
# exclusive inclusive rows x rows loops node
1. 1.240 223.703 ↓ 0.0 0 1

Update on cdr_event (cost=15,870,066.49..15,870,296.33 rows=5,599 width=308) (actual time=223.703..223.703 rows=0 loops=1)

2.          

CTE newer_alert_events

3. 29.113 218.960 ↑ 145.8 40 1

HashAggregate (cost=15,868,461.45..15,868,519.79 rows=5,834 width=16) (actual time=218.943..218.960 rows=40 loops=1)

4. 17.313 189.847 ↑ 71.2 173,585 1

Nested Loop (cost=0.57..15,775,709.01 rows=12,366,993 width=16) (actual time=1.274..189.847 rows=173,585 loops=1)

5. 2.294 2.294 ↓ 1.1 2,240 1

Seq Scan on cdr_event cdr_event_1 (cost=0.00..1,521.39 rows=2,025 width=24) (actual time=0.020..2.294 rows=2,240 loops=1)

  • Filter: (state = 'active'::text)
  • Rows Removed by Filter: 37
6. 170.240 170.240 ↑ 185.5 77 2,240

Index Scan using index_alert_event_on_adid_and_created_at_and_not_summary on alert_event (cost=0.57..7,646.86 rows=14,286 width=16) (actual time=0.001..0.076 rows=77 loops=2,240)

  • Index Cond: ((alert_definition_id = cdr_event_1.cdr_alert_id) AND (created_at > COALESCE(cdr_event_1.last_active_at, cdr_event_1.created_at)))
7. 0.047 222.463 ↑ 140.0 40 1

Hash Join (cost=1,546.70..1,776.53 rows=5,599 width=308) (actual time=222.397..222.463 rows=40 loops=1)

  • Hash Cond: (newer_alert_events.alert_definition_id = cdr_event.cdr_alert_id)
8. 218.983 218.983 ↑ 145.8 40 1

CTE Scan on newer_alert_events (cost=0.00..116.68 rows=5,834 width=72) (actual time=218.950..218.983 rows=40 loops=1)

9. 1.283 3.433 ↑ 1.1 1,817 1

Hash (cost=1,521.39..1,521.39 rows=2,025 width=244) (actual time=3.433..3.433 rows=1,817 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1113kB
10. 2.150 2.150 ↓ 1.1 2,240 1

Seq Scan on cdr_event (cost=0.00..1,521.39 rows=2,025 width=244) (actual time=0.015..2.150 rows=2,240 loops=1)

  • Filter: (state = 'active'::text)
  • Rows Removed by Filter: 37