explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 2Zk2

Settings
# exclusive inclusive rows x rows loops node
1. 1.272 3.296 ↑ 61.8 33 1

Nested Loop Left Join (cost=202.30..154,650.72 rows=2,040 width=1,012) (actual time=1.090..3.296 rows=33 loops=1)

2.          

CTE last_events

3. 0.008 0.051 ↑ 52.5 2 1

GroupAggregate (cost=20.74..24.82 rows=105 width=44) (actual time=0.050..0.051 rows=2 loops=1)

  • Group Key: alert_event.alert_domain_id
4. 0.003 0.043 ↑ 35.0 3 1

Unique (cost=20.74..21.67 rows=105 width=76) (actual time=0.040..0.043 rows=3 loops=1)

5. 0.024 0.040 ↑ 30.8 4 1

Sort (cost=20.74..21.05 rows=123 width=76) (actual time=0.040..0.040 rows=4 loops=1)

  • Sort Key: alert_event.alert_domain_id, alert_event.field_name, alert_event.created_date DESC
  • Sort Method: quicksort Memory: 25kB
6. 0.016 0.016 ↑ 30.8 4 1

Seq Scan on alert_event (cost=0.00..16.48 rows=123 width=76) (actual time=0.007..0.016 rows=4 loops=1)

  • Filter: (created_date > (now() - '24:00:00'::interval))
7. 0.026 1.298 ↑ 61.8 33 1

Hash Left Join (cost=151.88..90,881.44 rows=2,040 width=208) (actual time=0.980..1.298 rows=33 loops=1)

  • Hash Cond: (ad.id = le.alert_domain_id)
8. 0.016 1.217 ↑ 61.8 33 1

Nested Loop Left Join (cost=148.46..90,866.56 rows=2,040 width=168) (actual time=0.917..1.217 rows=33 loops=1)

9. 0.019 1.135 ↑ 61.8 33 1

Nested Loop Left Join (cost=143.69..49,466.86 rows=2,040 width=128) (actual time=0.900..1.135 rows=33 loops=1)

10. 0.041 0.951 ↑ 61.8 33 1

Hash Right Join (cost=138.97..169.02 rows=2,040 width=88) (actual time=0.890..0.951 rows=33 loops=1)

  • Hash Cond: ((rd.name = ad.name) AND (rd.account_id = a.account_id))
11. 0.066 0.802 ↑ 10.1 62 1

Hash Left Join (cost=22.64..43.16 rows=628 width=76) (actual time=0.750..0.802 rows=62 loops=1)

  • Hash Cond: (dgrd.group_id = dg.id)
12. 0.060 0.726 ↑ 10.1 62 1

Hash Right Join (cost=5.44..24.29 rows=628 width=44) (actual time=0.691..0.726 rows=62 loops=1)

  • Hash Cond: (dgrd.reg_domain_id = rd.id)
13. 0.014 0.014 ↑ 11.1 63 1

Seq Scan on domain_group_reg_domain dgrd (cost=0.00..17.00 rows=700 width=8) (actual time=0.007..0.014 rows=63 loops=1)

14. 0.615 0.652 ↓ 1.0 62 1

Hash (cost=4.68..4.68 rows=61 width=40) (actual time=0.652..0.652 rows=62 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 13kB
15. 0.037 0.037 ↓ 1.0 62 1

Seq Scan on reg_domain rd (cost=0.00..4.68 rows=61 width=40) (actual time=0.007..0.037 rows=62 loops=1)

  • Filter: (deleted IS NULL)
  • Rows Removed by Filter: 7
16. 0.003 0.010 ↑ 24.6 13 1

Hash (cost=13.20..13.20 rows=320 width=36) (actual time=0.010..0.010 rows=13 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
17. 0.007 0.007 ↑ 24.6 13 1

Seq Scan on domain_group dg (cost=0.00..13.20 rows=320 width=36) (actual time=0.005..0.007 rows=13 loops=1)

18. 0.008 0.108 ↑ 61.8 33 1

Hash (cost=85.72..85.72 rows=2,040 width=48) (actual time=0.108..0.108 rows=33 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 19kB
19. 0.031 0.100 ↑ 61.8 33 1

Hash Join (cost=44.53..85.72 rows=2,040 width=48) (actual time=0.084..0.100 rows=33 loops=1)

  • Hash Cond: (ada.alert_id = a.id)
20. 0.031 0.053 ↑ 61.8 33 1

Hash Join (cost=22.60..58.40 rows=2,040 width=48) (actual time=0.043..0.053 rows=33 loops=1)

  • Hash Cond: (ada.alert_domain_id = ad.id)
21. 0.007 0.007 ↑ 61.8 33 1

Seq Scan on alert_domain_alert ada (cost=0.00..30.40 rows=2,040 width=8) (actual time=0.004..0.007 rows=33 loops=1)

22. 0.006 0.015 ↑ 17.0 33 1

Hash (cost=15.60..15.60 rows=560 width=44) (actual time=0.015..0.015 rows=33 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
23. 0.009 0.009 ↑ 17.0 33 1

Seq Scan on alert_domain ad (cost=0.00..15.60 rows=560 width=44) (actual time=0.005..0.009 rows=33 loops=1)

24. 0.009 0.016 ↑ 530.0 1 1

Hash (cost=15.30..15.30 rows=530 width=8) (actual time=0.016..0.016 rows=1 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
25. 0.007 0.007 ↑ 530.0 1 1

Seq Scan on alert a (cost=0.00..15.30 rows=530 width=8) (actual time=0.007..0.007 rows=1 loops=1)

26. 0.000 0.165 ↓ 0.0 0 33

Nested Loop Left Join (cost=4.73..24.15 rows=1 width=40) (actual time=0.005..0.005 rows=0 loops=33)

27. 0.033 0.165 ↓ 0.0 0 33

Nested Loop Left Join (cost=4.58..22.26 rows=1 width=8) (actual time=0.005..0.005 rows=0 loops=33)

28. 0.000 0.132 ↓ 0.0 0 33

Nested Loop (cost=4.44..22.08 rows=1 width=4) (actual time=0.004..0.004 rows=0 loops=33)

29. 0.066 0.132 ↓ 0.0 0 33

Nested Loop (cost=4.30..16.34 rows=25 width=8) (actual time=0.004..0.004 rows=0 loops=33)

30. 0.033 0.066 ↓ 0.0 0 33

Bitmap Heap Scan on external_domain ed (cost=4.15..8.16 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=33)

  • Recheck Cond: (name = ad.name)
31. 0.033 0.033 ↓ 0.0 0 33

Bitmap Index Scan on external_domain_name_key (cost=0.00..4.15 rows=1 width=0) (actual time=0.001..0.001 rows=0 loops=33)

  • Index Cond: (name = ad.name)
32. 0.000 0.000 ↓ 0.0 0

Index Scan using external_domain_group_domain_external_domain_id_idx on external_domain_group_domain edgd (cost=0.15..8.17 rows=1 width=12) (never executed)

  • Index Cond: (external_domain_id = ed.id)
33. 0.000 0.000 ↓ 0.0 0

Index Scan using external_domain_group_pkey on external_domain_group edg (cost=0.15..0.23 rows=1 width=4) (never executed)

  • Index Cond: (id = edgd.external_domain_group_id)
  • Filter: (account_id = a.account_id)
34. 0.000 0.000 ↓ 0.0 0

Index Scan using domain_group_external_domain_external_domain_group_domain_i_key on domain_group_external_domain dged (cost=0.14..0.17 rows=1 width=8) (never executed)

  • Index Cond: (external_domain_group_domain_id = edgd.id)
35. 0.000 0.000 ↓ 0.0 0

Index Scan using domain_group_pkey on domain_group dg_1 (cost=0.15..1.88 rows=1 width=36) (never executed)

  • Index Cond: (id = dged.group_id)
36. 0.000 0.066 ↓ 0.0 0 33

Nested Loop Left Join (cost=4.77..20.27 rows=1 width=40) (actual time=0.002..0.002 rows=0 loops=33)

37. 0.033 0.066 ↓ 0.0 0 33

Nested Loop Left Join (cost=4.62..20.04 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=33)

38. 0.000 0.033 ↓ 0.0 0 33

Nested Loop (cost=4.47..19.81 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=33)

39. 0.000 0.033 ↓ 0.0 0 33

Nested Loop (cost=4.32..19.48 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=33)

40. 0.033 0.033 ↓ 0.0 0 33

Index Scan using external_host_name_key on external_host eh (cost=0.15..8.17 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=33)

  • Index Cond: (name = ad.name)
41. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on external_host_group_host ehgh (cost=4.17..11.28 rows=3 width=12) (never executed)

  • Recheck Cond: (external_host_id = eh.id)
42. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on external_host_group_host_external_host_id_idx (cost=0.00..4.17 rows=3 width=0) (never executed)

  • Index Cond: (external_host_id = eh.id)
43. 0.000 0.000 ↓ 0.0 0

Index Scan using external_host_group_pkey on external_host_group ehg (cost=0.15..0.24 rows=1 width=4) (never executed)

  • Index Cond: (id = ehgh.external_host_group_id)
  • Filter: (account_id = a.account_id)
44. 0.000 0.000 ↓ 0.0 0

Index Scan using domain_group_external_host_external_host_group_host_id_key on domain_group_external_host dgeh (cost=0.15..0.23 rows=1 width=8) (never executed)

  • Index Cond: (external_host_group_host_id = ehgh.id)
45. 0.000 0.000 ↓ 0.0 0

Index Scan using domain_group_pkey on domain_group dg_2 (cost=0.15..0.23 rows=1 width=36) (never executed)

  • Index Cond: (id = dgeh.group_id)
46. 0.001 0.055 ↑ 52.5 2 1

Hash (cost=2.10..2.10 rows=105 width=44) (actual time=0.055..0.055 rows=2 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
47. 0.054 0.054 ↑ 52.5 2 1

CTE Scan on last_events le (cost=0.00..2.10 rows=105 width=44) (actual time=0.051..0.054 rows=2 loops=1)

48. 0.033 0.165 ↓ 0.0 0 33

Limit (cost=25.61..25.61 rows=1 width=224) (actual time=0.005..0.005 rows=0 loops=33)

49. 0.033 0.132 ↓ 0.0 0 33

Sort (cost=25.61..25.61 rows=1 width=224) (actual time=0.004..0.004 rows=0 loops=33)

  • Sort Key: ae.created_date DESC
  • Sort Method: quicksort Memory: 25kB
50. 0.058 0.099 ↓ 0.0 0 33

Nested Loop (cost=0.15..25.60 rows=1 width=224) (actual time=0.003..0.003 rows=0 loops=33)

51. 0.033 0.033 ↓ 0.0 0 33

Seq Scan on alert_event ae (cost=0.00..17.40 rows=1 width=108) (actual time=0.001..0.001 rows=0 loops=33)

  • Filter: ((alert_domain_id = ad.id) AND (created_date > (now() - '24:00:00'::interval)))
  • Rows Removed by Filter: 4
52. 0.008 0.008 ↑ 1.0 1 4

Index Scan using alert_event_status_pkey on alert_event_status aes (cost=0.15..8.17 rows=1 width=36) (actual time=0.002..0.002 rows=1 loops=4)

  • Index Cond: (id = ae.status_id)
53.          

SubPlan (for Nested Loop Left Join)

54. 0.033 0.033 ↓ 0.0 0 33

Function Scan on json_array_elements issue (cost=0.01..1.25 rows=100 width=32) (actual time=0.001..0.001 rows=0 loops=33)

55. 0.528 0.528 ↓ 0.0 0 33

Function Scan on json_array_elements issue_1 (cost=0.01..1.25 rows=100 width=32) (actual time=0.016..0.016 rows=0 loops=33)

56. 0.000 0.000 ↓ 0.0 0 33

Function Scan on json_array_elements issue_2 (cost=0.01..1.25 rows=100 width=32) (actual time=0.000..0.000 rows=0 loops=33)

57. 0.000 0.000 ↓ 0.0 0 33

Function Scan on json_array_elements issue_3 (cost=0.01..1.25 rows=100 width=32) (actual time=0.000..0.000 rows=0 loops=33)

Planning time : 24.291 ms
Execution time : 3.714 ms