explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 0ymW

Settings
# exclusive inclusive rows x rows loops node
1. 0.071 1.325 ↓ 3.0 86 1

Sort (cost=431.55..431.62 rows=29 width=636) (actual time=1.320..1.325 rows=86 loops=1)

  • Sort Key: s.id
  • Sort Method: quicksort Memory: 112kB
2. 0.080 1.254 ↓ 3.0 86 1

Nested Loop Left Join (cost=405.62..430.84 rows=29 width=636) (actual time=1.159..1.254 rows=86 loops=1)

3. 0.111 1.174 ↓ 3.0 86 1

Hash Right Join (cost=405.35..420.46 rows=29 width=633) (actual time=1.148..1.174 rows=86 loops=1)

  • Hash Cond: (ls.sensor_id = s.id)
  • Join Filter: (ls.connected @> COALESCE(h.received_at, s.enumerated_at))
  • Rows Removed by Join Filter: 22
4. 0.064 0.064 ↓ 1.0 650 1

Seq Scan on line_sensors ls (cost=0.00..12.48 rows=648 width=24) (actual time=0.005..0.064 rows=650 loops=1)

5. 0.041 0.999 ↓ 3.0 86 1

Hash (cost=404.99..404.99 rows=29 width=629) (actual time=0.999..0.999 rows=86 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 77kB
6. 0.061 0.958 ↓ 3.0 86 1

Nested Loop Left Join (cost=54.59..404.99 rows=29 width=629) (actual time=0.515..0.958 rows=86 loops=1)

7. 0.086 0.897 ↓ 3.0 86 1

Hash Join (cost=54.16..165.91 rows=29 width=621) (actual time=0.511..0.897 rows=86 loops=1)

  • Hash Cond: (s.bru_id = b.id)
8. 0.318 0.318 ↑ 1.0 550 1

Seq Scan on sensors s (cost=0.00..109.40 rows=550 width=21) (actual time=0.008..0.318 rows=550 loops=1)

  • Filter: enumerated
  • Rows Removed by Filter: 590
9. 0.056 0.493 ↓ 9.1 146 1

Hash (cost=53.96..53.96 rows=16 width=608) (actual time=0.493..0.493 rows=146 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 122kB
10. 0.090 0.437 ↓ 9.1 146 1

Hash Join (cost=41.61..53.96 rows=16 width=608) (actual time=0.319..0.437 rows=146 loops=1)

  • Hash Cond: (b.gateway_id = g.id)
11. 0.036 0.036 ↑ 1.0 305 1

Seq Scan on brus b (cost=0.00..11.05 rows=305 width=8) (actual time=0.003..0.036 rows=305 loops=1)

12. 0.017 0.311 ↓ 11.0 44 1

Hash (cost=41.56..41.56 rows=4 width=608) (actual time=0.311..0.311 rows=44 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 43kB
13. 0.027 0.294 ↓ 11.0 44 1

Hash Join (cost=29.50..41.56 rows=4 width=608) (actual time=0.257..0.294 rows=44 loops=1)

  • Hash Cond: (g.establishment_id = st.establishment_id)
14. 0.016 0.016 ↑ 1.0 74 1

Seq Scan on gateways g (cost=0.00..11.74 rows=74 width=8) (actual time=0.002..0.016 rows=74 loops=1)

15. 0.002 0.251 ↑ 1.0 1 1

Hash (cost=29.49..29.49 rows=1 width=600) (actual time=0.251..0.251 rows=1 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
16. 0.003 0.249 ↑ 1.0 1 1

Merge Left Join (cost=26.47..29.49 rows=1 width=600) (actual time=0.242..0.249 rows=1 loops=1)

  • Merge Cond: (st.establishment_id = r.establishment_id)
17. 0.004 0.031 ↑ 1.0 1 1

Sort (cost=7.52..7.53 rows=1 width=547) (actual time=0.031..0.031 rows=1 loops=1)

  • Sort Key: st.establishment_id
  • Sort Method: quicksort Memory: 26kB
18. 0.027 0.027 ↑ 1.0 1 1

Seq Scan on statistic_tests st (cost=0.00..7.51 rows=1 width=547) (actual time=0.016..0.027 rows=1 loops=1)

  • Filter: (active AND (NOT archived) AND ((type)::text = 'age'::text))
  • Rows Removed by Filter: 120
19. 0.003 0.215 ↑ 40.0 2 1

Materialize (cost=18.95..21.75 rows=80 width=57) (actual time=0.208..0.215 rows=2 loops=1)

20. 0.018 0.212 ↑ 40.0 2 1

GroupAggregate (cost=18.95..20.75 rows=80 width=57) (actual time=0.206..0.212 rows=2 loops=1)

  • Group Key: r.establishment_id, e.name
21. 0.026 0.194 ↑ 11.4 7 1

Sort (cost=18.95..19.15 rows=80 width=36) (actual time=0.193..0.194 rows=7 loops=1)

  • Sort Key: r.establishment_id, e.name
  • Sort Method: quicksort Memory: 31kB
22. 0.023 0.168 ↑ 1.0 80 1

Hash Join (cost=11.80..16.42 rows=80 width=36) (actual time=0.087..0.168 rows=80 loops=1)

  • Hash Cond: (r.establishment_id = e.id)
23. 0.023 0.124 ↑ 1.0 80 1

Hash Join (cost=6.97..11.35 rows=80 width=15) (actual time=0.062..0.124 rows=80 loops=1)

  • Hash Cond: (ru.user_id = u.id)
24. 0.026 0.068 ↑ 1.0 80 1

Hash Join (cost=2.10..6.26 rows=80 width=8) (actual time=0.025..0.068 rows=80 loops=1)

  • Hash Cond: (ru.role_id = r.id)
25. 0.026 0.026 ↑ 1.0 80 1

Seq Scan on role_users ru (cost=0.00..3.93 rows=80 width=8) (actual time=0.005..0.026 rows=80 loops=1)

  • Filter: alerts_flag
  • Rows Removed by Filter: 113
26. 0.007 0.016 ↑ 1.0 49 1

Hash (cost=1.49..1.49 rows=49 width=8) (actual time=0.016..0.016 rows=49 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
27. 0.009 0.009 ↑ 1.0 49 1

Seq Scan on roles r (cost=0.00..1.49 rows=49 width=8) (actual time=0.003..0.009 rows=49 loops=1)

28. 0.013 0.033 ↑ 1.0 83 1

Hash (cost=3.83..3.83 rows=83 width=15) (actual time=0.033..0.033 rows=83 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 12kB
29. 0.020 0.020 ↑ 1.0 83 1

Seq Scan on users u (cost=0.00..3.83 rows=83 width=15) (actual time=0.003..0.020 rows=83 loops=1)

30. 0.010 0.021 ↑ 1.0 37 1

Hash (cost=4.37..4.37 rows=37 width=25) (actual time=0.020..0.021 rows=37 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
31. 0.011 0.011 ↑ 1.0 37 1

Seq Scan on establishments e (cost=0.00..4.37 rows=37 width=25) (actual time=0.002..0.011 rows=37 loops=1)

32. 0.000 0.000 ↓ 0.0 0 86

Index Scan using heartbeats_pkey on heartbeats h (cost=0.43..8.24 rows=1 width=12) (actual time=0.000..0.000 rows=0 loops=86)

  • Index Cond: (id = s.latest_heartbeat_id)
33. 0.000 0.000 ↓ 0.0 0 86

Index Scan using lines_pkey on lines l (cost=0.28..0.35 rows=1 width=11) (actual time=0.000..0.000 rows=0 loops=86)

  • Index Cond: (id = ls.line_id)
Planning time : 1.382 ms
Execution time : 1.436 ms