explain.depesz.com

PostgreSQL's explain analyze made readable

Result: B90J

Settings
# exclusive inclusive rows x rows loops node
1. 0.014 0.165 ↑ 12.0 3 1

HashAggregate (cost=27.83..28.19 rows=36 width=64) (actual time=0.163..0.165 rows=3 loops=1)

  • Group Key: ra_account_cte.account_id, ra_account_cte.account_name, ra_account_cte.parent_id
2.          

CTE ra_account_cte

3. 0.001 0.089 ↑ 31.0 1 1

Recursive Union (cost=0.00..17.09 rows=31 width=64) (actual time=0.060..0.089 rows=1 loops=1)

4. 0.005 0.059 ↑ 1.0 1 1

Nested Loop Semi Join (cost=0.00..3.12 rows=1 width=64) (actual time=0.058..0.059 rows=1 loops=1)

  • Join Filter: (a_3.parent_id = p_1.account_id)
  • Rows Removed by Join Filter: 2
5. 0.012 0.012 ↑ 1.0 3 1

Seq Scan on ra_account a_3 (cost=0.00..1.03 rows=3 width=64) (actual time=0.011..0.012 rows=3 loops=1)

6. 0.008 0.042 ↑ 1.0 1 3

Materialize (cost=0.00..2.04 rows=1 width=16) (actual time=0.010..0.014 rows=1 loops=3)

7. 0.007 0.034 ↑ 1.0 1 1

Nested Loop (cost=0.00..2.04 rows=1 width=16) (actual time=0.025..0.034 rows=1 loops=1)

  • Join Filter: (p_1.user_id = u_2.user_id)
  • Rows Removed by Join Filter: 1
8. 0.011 0.011 ↓ 2.0 2 1

Seq Scan on ra_permission p_1 (cost=0.00..1.01 rows=1 width=32) (actual time=0.009..0.011 rows=2 loops=1)

  • Filter: ((permission_cascade IS TRUE) AND (account_id IS NOT NULL))
  • Rows Removed by Filter: 2
9. 0.016 0.016 ↑ 1.0 1 2

Seq Scan on ra_user u_2 (cost=0.00..1.02 rows=1 width=16) (actual time=0.007..0.008 rows=1 loops=2)

  • Filter: ((user_id)::text = 'b8e8ba82-7e4c-4f2b-995c-af9716ab199d'::text)
  • Rows Removed by Filter: 0
10. 0.015 0.029 ↓ 0.0 0 1

Hash Join (cost=1.07..1.34 rows=3 width=64) (actual time=0.028..0.029 rows=0 loops=1)

  • Hash Cond: (p_2.account_id = c.parent_id)
11. 0.001 0.001 ↑ 10.0 1 1

WorkTable Scan on ra_account_cte p_2 (cost=0.00..0.20 rows=10 width=16) (actual time=0.001..0.001 rows=1 loops=1)

12. 0.007 0.013 ↑ 1.5 2 1

Hash (cost=1.03..1.03 rows=3 width=64) (actual time=0.012..0.013 rows=2 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
13. 0.006 0.006 ↑ 1.0 3 1

Seq Scan on ra_account c (cost=0.00..1.03 rows=3 width=64) (actual time=0.005..0.006 rows=3 loops=1)

14. 0.004 0.151 ↑ 6.0 6 1

Append (cost=0.00..10.47 rows=36 width=64) (actual time=0.064..0.151 rows=6 loops=1)

15. 0.093 0.093 ↑ 31.0 1 1

CTE Scan on ra_account_cte (cost=0.00..0.62 rows=31 width=64) (actual time=0.063..0.093 rows=1 loops=1)

16. 0.005 0.021 ↑ 1.0 3 1

Result (cost=3.09..4.12 rows=3 width=64) (actual time=0.020..0.021 rows=3 loops=1)

  • One-Time Filter: ((1 = $2) OR (1 = $3))
17.          

Initplan (for Result)

18. 0.004 0.010 ↑ 1.0 1 1

Aggregate (cost=1.02..1.03 rows=1 width=8) (actual time=0.010..0.010 rows=1 loops=1)

19. 0.006 0.006 ↑ 1.0 1 1

Seq Scan on ra_user u_3 (cost=0.00..1.02 rows=1 width=0) (actual time=0.005..0.006 rows=1 loops=1)

  • Filter: (user_is_administrator AND ((user_id)::text = 'b8e8ba82-7e4c-4f2b-995c-af9716ab199d'::text))
  • Rows Removed by Filter: 1
20. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=2.04..2.05 rows=1 width=8) (never executed)

21. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.00..2.04 rows=1 width=0) (never executed)

  • Join Filter: (p_3.user_id = u_4.user_id)
22. 0.000 0.000 ↓ 0.0 0

Seq Scan on ra_permission p_3 (cost=0.00..1.01 rows=1 width=16) (never executed)

  • Filter: ((account_id IS NULL) AND (place_id IS NULL) AND (thing_id IS NULL))
23. 0.000 0.000 ↓ 0.0 0

Seq Scan on ra_user u_4 (cost=0.00..1.02 rows=1 width=16) (never executed)

  • Filter: ((user_id)::text = 'b8e8ba82-7e4c-4f2b-995c-af9716ab199d'::text)
24. 0.006 0.006 ↑ 1.0 3 1

Seq Scan on ra_account a (cost=3.09..4.12 rows=3 width=64) (actual time=0.005..0.006 rows=3 loops=1)

25. 0.002 0.010 ↑ 1.0 1 1

Nested Loop (cost=0.00..2.09 rows=1 width=64) (actual time=0.009..0.010 rows=1 loops=1)

  • Join Filter: (u.account_id = a_1.account_id)
26. 0.006 0.006 ↑ 1.0 1 1

Seq Scan on ra_user u (cost=0.00..1.02 rows=1 width=16) (actual time=0.004..0.006 rows=1 loops=1)

  • Filter: ((user_id)::text = 'b8e8ba82-7e4c-4f2b-995c-af9716ab199d'::text)
  • Rows Removed by Filter: 1
27. 0.002 0.002 ↑ 3.0 1 1

Seq Scan on ra_account a_1 (cost=0.00..1.03 rows=3 width=64) (actual time=0.002..0.002 rows=1 loops=1)

28. 0.002 0.023 ↑ 1.0 1 1

Nested Loop (cost=0.00..3.11 rows=1 width=64) (actual time=0.017..0.023 rows=1 loops=1)

  • Join Filter: (p.account_id = a_2.account_id)
  • Rows Removed by Join Filter: 1
29. 0.004 0.019 ↑ 1.0 1 1

Nested Loop (cost=0.00..2.04 rows=1 width=16) (actual time=0.013..0.019 rows=1 loops=1)

  • Join Filter: (p.user_id = u_1.user_id)
  • Rows Removed by Join Filter: 1
30. 0.005 0.005 ↓ 2.0 2 1

Seq Scan on ra_permission p (cost=0.00..1.01 rows=1 width=32) (actual time=0.004..0.005 rows=2 loops=1)

  • Filter: (account_id IS NOT NULL)
  • Rows Removed by Filter: 2
31. 0.010 0.010 ↑ 1.0 1 2

Seq Scan on ra_user u_1 (cost=0.00..1.02 rows=1 width=16) (actual time=0.005..0.005 rows=1 loops=2)

  • Filter: ((user_id)::text = 'b8e8ba82-7e4c-4f2b-995c-af9716ab199d'::text)
  • Rows Removed by Filter: 0
32. 0.002 0.002 ↑ 1.5 2 1

Seq Scan on ra_account a_2 (cost=0.00..1.03 rows=3 width=64) (actual time=0.002..0.002 rows=2 loops=1)

Planning time : 1.178 ms
Execution time : 0.426 ms