explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 8cEc

Settings
# exclusive inclusive rows x rows loops node
1. 0.068 9.247 ↓ 0.0 0 1

Update on cdr_event (cost=16,901,201.25..16,901,431.10 rows=5,600 width=308) (actual time=9.247..9.247 rows=0 loops=1)

2.          

CTE newer_alert_events

3. 0.028 5.454 ↑ 1,944.7 3 1

HashAggregate (cost=16,899,592.09..16,899,650.43 rows=5,834 width=16) (actual time=5.442..5.454 rows=3 loops=1)

4. 0.597 5.426 ↑ 742,021.8 18 1

Nested Loop (cost=0.57..16,799,419.14 rows=13,356,393 width=16) (actual time=1.418..5.426 rows=18 loops=1)

5. 2.589 2.589 ↓ 1.0 2,240 1

Seq Scan on cdr_event cdr_event_1 (cost=0.00..1,523.49 rows=2,187 width=24) (actual time=0.018..2.589 rows=2,240 loops=1)

  • Filter: (state = 'active'::text)
  • Rows Removed by Filter: 37
6. 2.240 2.240 ↓ 0.0 0 2,240

Index Scan using index_alert_event_on_adid_and_created_at_and_not_summary on alert_event (cost=0.57..7,537.93 rows=14,286 width=16) (actual time=0.001..0.001 rows=0 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.019 9.179 ↑ 1,866.7 3 1

Hash Join (cost=1,550.83..1,780.68 rows=5,600 width=308) (actual time=9.163..9.179 rows=3 loops=1)

  • Hash Cond: (newer_alert_events.alert_definition_id = cdr_event.cdr_alert_id)
8. 5.461 5.461 ↑ 1,944.7 3 1

CTE Scan on newer_alert_events (cost=0.00..116.68 rows=5,834 width=72) (actual time=5.448..5.461 rows=3 loops=1)

9. 1.467 3.699 ↑ 1.2 1,817 1

Hash (cost=1,523.49..1,523.49 rows=2,187 width=244) (actual time=3.699..3.699 rows=1,817 loops=1)

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

Seq Scan on cdr_event (cost=0.00..1,523.49 rows=2,187 width=244) (actual time=0.014..2.232 rows=2,240 loops=1)

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