explain.depesz.com

PostgreSQL's explain analyze made readable

Result: UmBp

Settings
# exclusive inclusive rows x rows loops node
1. 0.011 0.798 ↑ 1.0 1 1

Result (cost=22.02..22.03 rows=1 width=160) (actual time=0.798..0.798 rows=1 loops=1)

2.          

Initplan (for Result)

3. 0.231 0.494 ↑ 1.0 1 1

Aggregate (cost=11.48..11.50 rows=1 width=32) (actual time=0.494..0.494 rows=1 loops=1)

4. 0.033 0.263 ↑ 1.0 23 1

Subquery Scan on itm (cost=11.14..11.42 rows=23 width=56) (actual time=0.255..0.263 rows=23 loops=1)

5. 0.052 0.230 ↑ 1.0 23 1

Sort (cost=11.14..11.19 rows=23 width=32) (actual time=0.228..0.230 rows=23 loops=1)

  • Sort Key: usr.local_user_id
  • Sort Method: quicksort Memory: 26kB
6. 0.050 0.178 ↑ 1.0 23 1

Hash Left Join (cost=1.04..10.62 rows=23 width=32) (actual time=0.097..0.178 rows=23 loops=1)

  • Hash Cond: (usr.role_id = rolt.role_id)
7. 0.101 0.101 ↑ 1.0 23 1

Seq Scan on users usr (cost=0.00..9.39 rows=23 width=32) (actual time=0.028..0.101 rows=23 loops=1)

  • Filter: (location_id = 1)
  • Rows Removed by Filter: 248
8. 0.004 0.027 ↑ 1.0 2 1

Hash (cost=1.02..1.02 rows=2 width=4) (actual time=0.027..0.027 rows=2 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
9. 0.023 0.023 ↑ 1.0 2 1

Seq Scan on role_types rolt (cost=0.00..1.02 rows=2 width=4) (actual time=0.022..0.023 rows=2 loops=1)

10. 0.053 0.104 ↑ 1.0 1 1

Aggregate (cost=4.60..4.62 rows=1 width=32) (actual time=0.104..0.104 rows=1 loops=1)

11. 0.005 0.051 ↑ 1.0 15 1

Subquery Scan on itm_1 (cost=0.15..4.56 rows=15 width=32) (actual time=0.046..0.051 rows=15 loops=1)

12. 0.046 0.046 ↑ 1.0 15 1

Index Only Scan using role_permissions_pkey on role_permissions rolperm (cost=0.15..4.41 rows=15 width=8) (actual time=0.044..0.046 rows=15 loops=1)

  • Index Cond: (location_id = 1)
  • Heap Fetches: 0
13. 0.029 0.040 ↑ 1.0 1 1

Aggregate (cost=1.06..1.08 rows=1 width=32) (actual time=0.040..0.040 rows=1 loops=1)

14. 0.002 0.011 ↑ 1.0 2 1

Subquery Scan on itm_2 (cost=1.03..1.05 rows=2 width=40) (actual time=0.010..0.011 rows=2 loops=1)

15. 0.006 0.009 ↑ 1.0 2 1

Sort (cost=1.03..1.03 rows=2 width=16) (actual time=0.008..0.009 rows=2 loops=1)

  • Sort Key: rolt_1.role_id
  • Sort Method: quicksort Memory: 25kB
16. 0.003 0.003 ↑ 1.0 2 1

Seq Scan on role_types rolt_1 (cost=0.00..1.02 rows=2 width=16) (actual time=0.003..0.003 rows=2 loops=1)

17. 0.040 0.080 ↑ 1.0 1 1

Aggregate (cost=1.37..1.39 rows=1 width=32) (actual time=0.080..0.080 rows=1 loops=1)

18. 0.005 0.040 ↑ 1.0 9 1

Subquery Scan on itm_3 (cost=1.23..1.35 rows=9 width=50) (actual time=0.038..0.040 rows=9 loops=1)

19. 0.021 0.035 ↑ 1.0 9 1

Sort (cost=1.23..1.26 rows=9 width=26) (actual time=0.035..0.035 rows=9 loops=1)

  • Sort Key: pemt.permission_id
  • Sort Method: quicksort Memory: 25kB
20. 0.014 0.014 ↑ 1.0 9 1

Seq Scan on permission_types pemt (cost=0.00..1.09 rows=9 width=26) (actual time=0.014..0.014 rows=9 loops=1)

21. 0.035 0.069 ↑ 1.0 1 1

Aggregate (cost=3.42..3.44 rows=1 width=32) (actual time=0.069..0.069 rows=1 loops=1)

22. 0.004 0.034 ↑ 1.1 9 1

Subquery Scan on itm_4 (cost=3.27..3.39 rows=10 width=30) (actual time=0.032..0.034 rows=9 loops=1)

23. 0.004 0.030 ↑ 1.1 9 1

Sort (cost=3.27..3.29 rows=10 width=6) (actual time=0.030..0.030 rows=9 loops=1)

  • Sort Key: locp.permission_id
  • Sort Method: quicksort Memory: 25kB
24. 0.026 0.026 ↑ 1.1 9 1

Seq Scan on location_permissions locp (cost=0.00..3.10 rows=10 width=6) (actual time=0.023..0.026 rows=9 loops=1)

  • Filter: (location_id = 1)
  • Rows Removed by Filter: 159