explain.depesz.com

PostgreSQL's explain analyze made readable

Result: K0FbM : Optimization for: Optimization for: plan #DLUs; plan #Leaj

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 10,070.796 10,071.092 ↑ 1.3 1,087 1

Seq Scan on m_organization org (cost=0.00..27,168.28 rows=1,422 width=3,558) (actual time=6.308..10,071.092 rows=1,087 loops=1)

  • Filter: ((alternatives: SubPlan 2 or hashed SubPlan 4) OR (cid = ANY (get_territories_ids_by_permision((f_sys_get_config('sysuser'::text))::integer))))
  • Rows Removed by Filter: 670
2.          

SubPlan (forSeq Scan)

3. 0.000 0.000 ↓ 0.0 0

Result (cost=13.67..15.03 rows=1 width=0) (never executed)

  • One-Time Filter: $0
4.          

Initplan (forResult)

5. 0.000 0.000 ↓ 0.0 0

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

  • Join Filter: (t.roleid = t1.roleid)
6. 0.000 0.000 ↓ 0.0 0

Seq Scan on urprivs t (cost=0.00..7.66 rows=1 width=5) (never executed)

  • Filter: ((lpu IS NULL) AND (version IS NULL) AND ((unitcode)::text = 'permisions'::text))
7. 0.000 0.000 ↓ 0.0 0

Seq Scan on userroles t1 (cost=0.00..1.42 rows=2 width=5) (never executed)

  • Filter: (sysuser = (f_sys_get_config('sysuser'::text))::numeric)
8. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=13.67..15.03 rows=1 width=0) (never executed)

  • Hash Cond: (t1_1.id = (t_1.f_pid)::numeric)
9. 0.000 0.000 ↓ 0.0 0

Seq Scan on users t1_1 (cost=0.00..1.23 rows=23 width=5) (never executed)

10. 0.000 0.000 ↓ 0.0 0

Hash (cost=4.55..4.55 rows=1 width=4) (never executed)

11. 0.000 0.000 ↓ 0.0 0

Index Only Scan using permisions_f_pid_f_org_id_idx on permisions t_1 (cost=0.28..4.55 rows=1 width=4) (never executed)

  • Index Cond: ((f_pid = (f_sys_get_config('sysuser'::text))::integer) AND (f_org_id IS NOT NULL))
  • Filter: (get_organization_orgreestr_id(f_org_id) = org.f_link2reestr)
  • Heap Fetches: 0
12. 0.000 0.296 ↓ 0.0 0 1

Result (cost=13.42..15.03 rows=1 width=8) (actual time=0.296..0.296 rows=0 loops=1)

  • One-Time Filter: $3
13.          

Initplan (forResult)

14. 0.002 0.269 ↑ 1.0 1 1

Nested Loop (cost=0.00..9.11 rows=1 width=0) (actual time=0.269..0.269 rows=1 loops=1)

  • Join Filter: (t_2.roleid = t1_2.roleid)
  • Rows Removed by Join Filter: 1
15. 0.030 0.030 ↑ 1.0 1 1

Seq Scan on urprivs t_2 (cost=0.00..7.66 rows=1 width=5) (actual time=0.030..0.030 rows=1 loops=1)

  • Filter: ((lpu IS NULL) AND (version IS NULL) AND ((unitcode)::text = 'permisions'::text))
  • Rows Removed by Filter: 172
16. 0.237 0.237 ↑ 1.0 2 1

Seq Scan on userroles t1_2 (cost=0.00..1.42 rows=2 width=5) (actual time=0.205..0.237 rows=2 loops=1)

  • Filter: (sysuser = (f_sys_get_config('sysuser'::text))::numeric)
  • Rows Removed by Filter: 19
17. 0.003 0.027 ↓ 0.0 0 1

Hash Join (cost=13.42..15.03 rows=1 width=8) (actual time=0.027..0.027 rows=0 loops=1)

  • Hash Cond: (t1_3.id = (t_3.f_pid)::numeric)
18. 0.003 0.003 ↑ 23.0 1 1

Seq Scan on users t1_3 (cost=0.00..1.23 rows=23 width=5) (actual time=0.003..0.003 rows=1 loops=1)

19. 0.000 0.021 ↓ 0.0 0 1

Hash (cost=4.30..4.30 rows=1 width=12) (actual time=0.021..0.021 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
20. 0.021 0.021 ↓ 0.0 0 1

Index Only Scan using permisions_f_pid_f_org_id_idx on permisions t_3 (cost=0.28..4.30 rows=1 width=12) (actual time=0.021..0.021 rows=0 loops=1)

  • Index Cond: ((f_pid = (f_sys_get_config('sysuser'::text))::integer) AND (f_org_id IS NOT NULL))
  • Heap Fetches: 0