explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xqkM

Settings
# exclusive inclusive rows x rows loops node
1. 0.009 271.120 ↑ 1.0 1 1

Result (cost=650,544.55..650,544.56 rows=1 width=65) (actual time=271.120..271.120 rows=1 loops=1)

  • Output: COALESCE($151, '[]'::json), $189, $227
2.          

CTE __local_0__

3. 0.093 141.579 ↑ 1.0 1 1

WindowAgg (cost=216,495.20..217,594.32 rows=1 width=68) (actual time=141.576..141.579 rows=1 loops=1)

  • Output: to_json(json_build_object('@node'::text, json_build_object('id'::text, __local_1__.id, 'userId'::text, __local_1__.user_id, 'isArchived'::text, __local_1__.is_archived, '@logo'::text, (SubPlan 1), '@jobPositionTitle'::text, (SubPlan 2), '@jobPositionType'::text, (SubPlan 3), '@jobPositionDescription'::text, (SubPlan 4), 'isLeader'::text, __local_1__.is_leader, '@latestFormFieldsEntries'::text, (SubPlan 7), '@user'::text, (SubPlan 51)))), to_json(json_build_array('user_by_user_id__first_name_asc', 'user_by_user_id__last_name_asc', (0 + row_number() OVER (?)))), (1)
4. 0.004 78.453 ↑ 1.0 1 1

Subquery Scan on __local_1__ (cost=216,495.20..216,495.22 rows=1 width=171) (actual time=78.451..78.453 rows=1 loops=1)

  • Output: 1, __local_1__.id, __local_1__.user_id, __local_1__.is_archived, __local_1__.active, __local_1__.created_at, __local_1__.updated_at, __local_1__.company_id, __local_1__.departments, __local_1__.employment_end, __local_1__.is_leader, __local_1__.leader_departments, __local_1__.group_ids
5. 0.003 78.449 ↑ 1.0 1 1

Limit (cost=216,495.20..216,495.21 rows=1 width=231) (actual time=78.448..78.449 rows=1 loops=1)

  • Output: __local_1___1.id, __local_1___1.user_id, __local_1___1.active, __local_1___1.created_at, __local_1___1.updated_at, __local_1___1.is_archived, __local_1___1.company_id, __local_1___1.departments, __local_1___1.employment_end, __local_1___1.is_leader, __local_1___1.leader_departments, __local_1___1.group_ids, ((SubPlan 52)), ((SubPlan 53))
6. 0.030 78.446 ↑ 1.0 1 1

Sort (cost=216,495.20..216,495.21 rows=1 width=231) (actual time=78.446..78.446 rows=1 loops=1)

  • Output: __local_1___1.id, __local_1___1.user_id, __local_1___1.active, __local_1___1.created_at, __local_1___1.updated_at, __local_1___1.is_archived, __local_1___1.company_id, __local_1___1.departments, __local_1___1.employment_end, __local_1___1.is_leader, __local_1___1.leader_departments, __local_1___1.group_ids, ((SubPlan 52)), ((SubPlan 53))
  • Sort Key: ((SubPlan 52)), ((SubPlan 53))
  • Sort Method: quicksort Memory: 25kB
7. 0.014 78.416 ↑ 1.0 1 1

Nested Loop (cost=0.53..216,495.19 rows=1 width=231) (actual time=64.878..78.416 rows=1 loops=1)

  • Output: __local_1___1.id, __local_1___1.user_id, __local_1___1.active, __local_1___1.created_at, __local_1___1.updated_at, __local_1___1.is_archived, __local_1___1.company_id, __local_1___1.departments, __local_1___1.employment_end, __local_1___1.is_leader, __local_1___1.leader_departments, __local_1___1.group_ids, (SubPlan 52), (SubPlan 53)
  • Inner Unique: true
8. 60.199 76.726 ↑ 1.0 1 1

Function Scan on public.employees_search __local_1___1 (cost=0.25..216,465.25 rows=1 width=167) (actual time=63.189..76.726 rows=1 loops=1)

  • Output: __local_1___1.id, __local_1___1.user_id, __local_1___1.active, __local_1___1.created_at, __local_1___1.updated_at, __local_1___1.is_archived, __local_1___1.company_id, __local_1___1.departments, __local_1___1.employment_end, __local_1___1.is_leader, __local_1___1.leader_departments, __local_1___1.group_ids
  • Function Call: employees_search('Anne1 Niels'::text)
  • Filter: (__local_1___1.active AND ((__local_1___1.employment_end IS NULL) OR (__local_1___1.employment_end > '2020-02-05'::date)) AND (__local_1___1.company_id = '47d08a0b-2c1b-4591-acc0-4d521915c8ef'::uuid) AND (((__local_1___1.employment_end IS NULL) AND ((employee_job_position_title(__local_1___1.*))::text ~~* '%Anne1 Niels%'::text)) OR ((__local_1___1.employment_end > '2020-02-05'::date) AND (employee_job_position_description(__local_1___1.*) ~~* '%Anne1 Niels%'::text)) OR (alternatives: SubPlan 54 or hashed SubPlan 55) OR (alternatives: SubPlan 56 or hashed SubPlan 57) OR (alternatives: SubPlan 58 or hashed SubPlan 59) OR (alternatives: SubPlan 60 or hashed SubPlan 61) OR (alternatives: SubPlan 62 or hashed SubPlan 63) OR (alternatives: SubPlan 64 or hashed SubPlan 65) OR (alternatives: SubPlan 66 or hashed SubPlan 67) OR (alternatives: SubPlan 68 or hashed SubPlan 69) OR (alternatives: SubPlan 70 or hashed SubPlan 71) OR (alternatives: SubPlan 72 or hashed SubPlan 73) OR (alternatives: SubPlan 74 or hashed SubPlan 75) OR (alternatives: SubPlan 76 or hashed SubPlan 77) OR (alternatives: SubPlan 78 or hashed SubPlan 79) OR (alternatives: SubPlan 80 or hashed SubPlan 81)))
  • Rows Removed by Filter: 1
9.          

SubPlan (for Function Scan)

10. 1.576 1.576 ↓ 0.0 0 2

Index Scan using vw_user_id_company_idx on public."user" __local_53__ (cost=0.28..10.06 rows=1 width=0) (actual time=0.788..0.788 rows=0 loops=2)

  • Index Cond: (__local_1___1.user_id = __local_53__.id)
  • Filter: ((policy_superadmin() OR (__local_53__.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_53__.id, __local_53__.departments, __local_53__.company_id) OR (__local_53__.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_53__.id, __local_53__.departments, __local_53__.company_id)) OR policy_superadmin() OR (__local_53__.id = current_user_id())) AND ((user_first_name(__local_53__.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
11. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_53___1 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_53___1.id
  • Filter: ((policy_superadmin() OR (__local_53___1.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_53___1.id, __local_53___1.departments, __local_53___1.company_id) OR (__local_53___1.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_53___1.id, __local_53___1.departments, __local_53___1.company_id)) OR policy_superadmin() OR (__local_53___1.id = current_user_id())) AND ((user_first_name(__local_53___1.*))::text ~~* '%Anne1 Niels%'::text))
12. 2.046 2.046 ↓ 0.0 0 2

Index Scan using vw_user_id_company_idx on public."user" __local_54__ (cost=0.28..10.06 rows=1 width=0) (actual time=1.023..1.023 rows=0 loops=2)

  • Index Cond: (__local_1___1.user_id = __local_54__.id)
  • Filter: ((policy_superadmin() OR (__local_54__.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_54__.id, __local_54__.departments, __local_54__.company_id) OR (__local_54__.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_54__.id, __local_54__.departments, __local_54__.company_id)) OR policy_superadmin() OR (__local_54__.id = current_user_id())) AND ((user_last_name(__local_54__.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
13. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_54___1 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_54___1.id
  • Filter: ((policy_superadmin() OR (__local_54___1.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_54___1.id, __local_54___1.departments, __local_54___1.company_id) OR (__local_54___1.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_54___1.id, __local_54___1.departments, __local_54___1.company_id)) OR policy_superadmin() OR (__local_54___1.id = current_user_id())) AND ((user_last_name(__local_54___1.*))::text ~~* '%Anne1 Niels%'::text))
14. 2.038 2.038 ↓ 0.0 0 2

Index Scan using vw_user_id_company_idx on public."user" __local_55__ (cost=0.28..10.06 rows=1 width=0) (actual time=1.019..1.019 rows=0 loops=2)

  • Index Cond: (__local_1___1.user_id = __local_55__.id)
  • Filter: ((policy_superadmin() OR (__local_55__.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_55__.id, __local_55__.departments, __local_55__.company_id) OR (__local_55__.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_55__.id, __local_55__.departments, __local_55__.company_id)) OR policy_superadmin() OR (__local_55__.id = current_user_id())) AND ((user_full_name(__local_55__.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 0
15. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_55___1 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_55___1.id
  • Filter: ((policy_superadmin() OR (__local_55___1.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_55___1.id, __local_55___1.departments, __local_55___1.company_id) OR (__local_55___1.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_55___1.id, __local_55___1.departments, __local_55___1.company_id)) OR policy_superadmin() OR (__local_55___1.id = current_user_id())) AND ((user_full_name(__local_55___1.*))::text ~~* '%Anne1 Niels%'::text))
16. 0.946 0.946 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_56__ (cost=0.28..10.06 rows=1 width=0) (actual time=0.946..0.946 rows=0 loops=1)

  • Index Cond: (__local_1___1.user_id = __local_56__.id)
  • Filter: ((policy_superadmin() OR (__local_56__.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_56__.id, __local_56__.departments, __local_56__.company_id) OR (__local_56__.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_56__.id, __local_56__.departments, __local_56__.company_id)) OR policy_superadmin() OR (__local_56__.id = current_user_id())) AND ((user_email(__local_56__.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
17. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_56___1 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_56___1.id
  • Filter: ((policy_superadmin() OR (__local_56___1.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_56___1.id, __local_56___1.departments, __local_56___1.company_id) OR (__local_56___1.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_56___1.id, __local_56___1.departments, __local_56___1.company_id)) OR policy_superadmin() OR (__local_56___1.id = current_user_id())) AND ((user_email(__local_56___1.*))::text ~~* '%Anne1 Niels%'::text))
18. 1.531 1.531 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_57__ (cost=0.28..10.06 rows=1 width=0) (actual time=1.531..1.531 rows=0 loops=1)

  • Index Cond: (__local_1___1.user_id = __local_57__.id)
  • Filter: ((policy_superadmin() OR (__local_57__.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_57__.id, __local_57__.departments, __local_57__.company_id) OR (__local_57__.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_57__.id, __local_57__.departments, __local_57__.company_id)) OR policy_superadmin() OR (__local_57__.id = current_user_id())) AND ((user_email_work(__local_57__.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
19. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_57___1 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_57___1.id
  • Filter: ((policy_superadmin() OR (__local_57___1.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_57___1.id, __local_57___1.departments, __local_57___1.company_id) OR (__local_57___1.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_57___1.id, __local_57___1.departments, __local_57___1.company_id)) OR policy_superadmin() OR (__local_57___1.id = current_user_id())) AND ((user_email_work(__local_57___1.*))::text ~~* '%Anne1 Niels%'::text))
20. 1.622 1.622 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_58__ (cost=0.28..10.06 rows=1 width=0) (actual time=1.622..1.622 rows=0 loops=1)

  • Index Cond: (__local_1___1.user_id = __local_58__.id)
  • Filter: ((policy_superadmin() OR (__local_58__.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_58__.id, __local_58__.departments, __local_58__.company_id) OR (__local_58__.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_58__.id, __local_58__.departments, __local_58__.company_id)) OR policy_superadmin() OR (__local_58__.id = current_user_id())) AND ((user_phone(__local_58__.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
21. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_58___1 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_58___1.id
  • Filter: ((policy_superadmin() OR (__local_58___1.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_58___1.id, __local_58___1.departments, __local_58___1.company_id) OR (__local_58___1.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_58___1.id, __local_58___1.departments, __local_58___1.company_id)) OR policy_superadmin() OR (__local_58___1.id = current_user_id())) AND ((user_phone(__local_58___1.*))::text ~~* '%Anne1 Niels%'::text))
22. 0.765 0.765 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_59__ (cost=0.28..10.06 rows=1 width=0) (actual time=0.765..0.765 rows=0 loops=1)

  • Index Cond: (__local_1___1.user_id = __local_59__.id)
  • Filter: ((policy_superadmin() OR (__local_59__.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_59__.id, __local_59__.departments, __local_59__.company_id) OR (__local_59__.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_59__.id, __local_59__.departments, __local_59__.company_id)) OR policy_superadmin() OR (__local_59__.id = current_user_id())) AND ((user_mobile(__local_59__.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
23. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_59___1 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_59___1.id
  • Filter: ((policy_superadmin() OR (__local_59___1.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_59___1.id, __local_59___1.departments, __local_59___1.company_id) OR (__local_59___1.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_59___1.id, __local_59___1.departments, __local_59___1.company_id)) OR policy_superadmin() OR (__local_59___1.id = current_user_id())) AND ((user_mobile(__local_59___1.*))::text ~~* '%Anne1 Niels%'::text))
24. 1.116 1.116 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_60__ (cost=0.28..10.06 rows=1 width=0) (actual time=1.116..1.116 rows=0 loops=1)

  • Index Cond: (__local_1___1.user_id = __local_60__.id)
  • Filter: ((policy_superadmin() OR (__local_60__.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_60__.id, __local_60__.departments, __local_60__.company_id) OR (__local_60__.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_60__.id, __local_60__.departments, __local_60__.company_id)) OR policy_superadmin() OR (__local_60__.id = current_user_id())) AND ((user_address(__local_60__.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
25. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_60___1 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_60___1.id
  • Filter: ((policy_superadmin() OR (__local_60___1.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_60___1.id, __local_60___1.departments, __local_60___1.company_id) OR (__local_60___1.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_60___1.id, __local_60___1.departments, __local_60___1.company_id)) OR policy_superadmin() OR (__local_60___1.id = current_user_id())) AND ((user_address(__local_60___1.*))::text ~~* '%Anne1 Niels%'::text))
26. 1.236 1.236 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_61__ (cost=0.28..10.06 rows=1 width=0) (actual time=1.236..1.236 rows=0 loops=1)

  • Index Cond: (__local_1___1.user_id = __local_61__.id)
  • Filter: ((policy_superadmin() OR (__local_61__.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_61__.id, __local_61__.departments, __local_61__.company_id) OR (__local_61__.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_61__.id, __local_61__.departments, __local_61__.company_id)) OR policy_superadmin() OR (__local_61__.id = current_user_id())) AND ((user_city(__local_61__.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
27. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_61___1 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_61___1.id
  • Filter: ((policy_superadmin() OR (__local_61___1.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_61___1.id, __local_61___1.departments, __local_61___1.company_id) OR (__local_61___1.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_61___1.id, __local_61___1.departments, __local_61___1.company_id)) OR policy_superadmin() OR (__local_61___1.id = current_user_id())) AND ((user_city(__local_61___1.*))::text ~~* '%Anne1 Niels%'::text))
28. 1.465 1.465 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_62__ (cost=0.28..10.06 rows=1 width=0) (actual time=1.465..1.465 rows=0 loops=1)

  • Index Cond: (__local_1___1.user_id = __local_62__.id)
  • Filter: ((policy_superadmin() OR (__local_62__.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_62__.id, __local_62__.departments, __local_62__.company_id) OR (__local_62__.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_62__.id, __local_62__.departments, __local_62__.company_id)) OR policy_superadmin() OR (__local_62__.id = current_user_id())) AND ((user_postal_code(__local_62__.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
29. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_62___1 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_62___1.id
  • Filter: ((policy_superadmin() OR (__local_62___1.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_62___1.id, __local_62___1.departments, __local_62___1.company_id) OR (__local_62___1.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_62___1.id, __local_62___1.departments, __local_62___1.company_id)) OR policy_superadmin() OR (__local_62___1.id = current_user_id())) AND ((user_postal_code(__local_62___1.*))::text ~~* '%Anne1 Niels%'::text))
30. 0.884 0.884 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_63__ (cost=0.28..10.06 rows=1 width=0) (actual time=0.884..0.884 rows=0 loops=1)

  • Index Cond: (__local_1___1.user_id = __local_63__.id)
  • Filter: ((policy_superadmin() OR (__local_63__.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_63__.id, __local_63__.departments, __local_63__.company_id) OR (__local_63__.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_63__.id, __local_63__.departments, __local_63__.company_id)) OR policy_superadmin() OR (__local_63__.id = current_user_id())) AND ((user_country(__local_63__.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
31. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_63___1 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_63___1.id
  • Filter: ((policy_superadmin() OR (__local_63___1.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_63___1.id, __local_63___1.departments, __local_63___1.company_id) OR (__local_63___1.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_63___1.id, __local_63___1.departments, __local_63___1.company_id)) OR policy_superadmin() OR (__local_63___1.id = current_user_id())) AND ((user_country(__local_63___1.*))::text ~~* '%Anne1 Niels%'::text))
32. 0.004 0.474 ↓ 0.0 0 1

Nested Loop Semi Join (cost=0.84..34.94 rows=1 width=0) (actual time=0.474..0.474 rows=0 loops=1)

33. 0.379 0.379 ↑ 1.0 1 1

Index Scan using vw_user_id_company_idx on public."user" __local_64__ (cost=0.28..9.81 rows=1 width=16) (actual time=0.378..0.379 rows=1 loops=1)

  • Output: __local_64__.id
  • Index Cond: (__local_64__.id = __local_1___1.user_id)
  • Filter: ((policy_superadmin() OR (__local_64__.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_64__.id, __local_64__.departments, __local_64__.company_id) OR (__local_64__.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_64__.id, __local_64__.departments, __local_64__.company_id)) OR policy_superadmin() OR (__local_64__.id = current_user_id())))
34. 0.003 0.091 ↓ 0.0 0 1

Nested Loop (cost=0.56..25.12 rows=1 width=16) (actual time=0.091..0.091 rows=0 loops=1)

  • Output: __local_65__.user_id
  • Inner Unique: true
35. 0.022 0.022 ↓ 2.0 2 1

Index Only Scan using user_group_pkey on public.user_group __local_65__ (cost=0.28..8.29 rows=1 width=32) (actual time=0.017..0.022 rows=2 loops=1)

  • Output: __local_65__.user_id, __local_65__.group_id
  • Index Cond: (__local_65__.user_id = __local_1___1.user_id)
  • Heap Fetches: 2
36. 0.066 0.066 ↓ 0.0 0 2

Index Scan using group_pkey on public."group" __local_66__ (cost=0.28..8.55 rows=1 width=16) (actual time=0.033..0.033 rows=0 loops=2)

  • Output: __local_66__.id
  • Index Cond: (__local_66__.id = __local_65__.group_id)
  • Filter: ((__local_66__.company_id = current_user_company()) AND ((__local_66__.description)::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
37. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=96.91..100.07 rows=1 width=16) (never executed)

  • Output: __local_64___1.id
  • Inner Unique: true
38. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=96.63..96.64 rows=1 width=16) (never executed)

  • Output: __local_65___1.user_id
  • Group Key: __local_65___1.user_id
39. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=63.80..96.62 rows=1 width=16) (never executed)

  • Output: __local_65___1.user_id
  • Inner Unique: true
  • Hash Cond: (__local_65___1.group_id = __local_66___1.id)
40. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.user_group __local_65___1 (cost=0.00..29.11 rows=1,411 width=32) (never executed)

  • Output: __local_65___1.user_id, __local_65___1.group_id, __local_65___1.company_id
41. 0.000 0.000 ↓ 0.0 0

Hash (cost=63.79..63.79 rows=1 width=16) (never executed)

  • Output: __local_66___1.id
42. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public."group" __local_66___1 (cost=9.12..63.79 rows=1 width=16) (never executed)

  • Output: __local_66___1.id
  • Recheck Cond: (__local_66___1.company_id = current_user_company())
  • Filter: ((__local_66___1.description)::text ~~* '%Anne1 Niels%'::text)
43. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on public_group_company_name_scope_idx (cost=0.00..9.12 rows=78 width=0) (never executed)

  • Index Cond: (__local_66___1.company_id = current_user_company())
44. 0.000 0.000 ↓ 0.0 0

Index Scan using user_pkey on public."user" __local_64___1 (cost=0.28..3.43 rows=1 width=16) (never executed)

  • Output: __local_64___1.id
  • Index Cond: (__local_64___1.id = __local_65___1.user_id)
  • Filter: ((policy_superadmin() OR (__local_64___1.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_64___1.id, __local_64___1.departments, __local_64___1.company_id) OR (__local_64___1.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_64___1.id, __local_64___1.departments, __local_64___1.company_id)) OR policy_superadmin() OR (__local_64___1.id = current_user_id())))
45. 0.003 0.466 ↓ 0.0 0 1

Nested Loop Semi Join (cost=0.84..35.19 rows=1 width=0) (actual time=0.466..0.466 rows=0 loops=1)

46. 0.454 0.454 ↑ 1.0 1 1

Index Scan using vw_user_id_company_idx on public."user" __local_67__ (cost=0.28..9.81 rows=1 width=16) (actual time=0.453..0.454 rows=1 loops=1)

  • Output: __local_67__.id
  • Index Cond: (__local_67__.id = __local_1___1.user_id)
  • Filter: ((policy_superadmin() OR (__local_67__.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_67__.id, __local_67__.departments, __local_67__.company_id) OR (__local_67__.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_67__.id, __local_67__.departments, __local_67__.company_id)) OR policy_superadmin() OR (__local_67__.id = current_user_id())))
47. 0.002 0.009 ↓ 0.0 0 1

Nested Loop (cost=0.56..25.37 rows=1 width=16) (actual time=0.009..0.009 rows=0 loops=1)

  • Output: __local_68__.user_id
  • Inner Unique: true
48. 0.007 0.007 ↓ 0.0 0 1

Index Scan using user_department_group_user_id_index on public.user_department_group __local_68__ (cost=0.28..8.55 rows=1 width=32) (actual time=0.007..0.007 rows=0 loops=1)

  • Output: __local_68__.group_id, __local_68__.user_id
  • Index Cond: (__local_68__.user_id = __local_1___1.user_id)
  • Filter: (__local_68__.company_id = current_user_company())
49. 0.000 0.000 ↓ 0.0 0

Index Scan using group_pkey on public."group" __local_69__ (cost=0.28..8.55 rows=1 width=16) (never executed)

  • Output: __local_69__.id
  • Index Cond: (__local_69__.id = __local_68__.group_id)
  • Filter: ((__local_69__.company_id = current_user_company()) AND ((__local_69__.description)::text ~~* '%Anne1 Niels%'::text))
50. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=77.75..86.13 rows=1 width=16) (never executed)

  • Output: __local_67___1.id
  • Inner Unique: true
51. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=77.47..77.48 rows=1 width=16) (never executed)

  • Output: __local_68___1.user_id
  • Group Key: __local_68___1.user_id
52. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=18.52..77.46 rows=1 width=16) (never executed)

  • Output: __local_68___1.user_id
53. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public."group" __local_69___1 (cost=9.12..63.79 rows=1 width=16) (never executed)

  • Output: __local_69___1.id
  • Recheck Cond: (__local_69___1.company_id = current_user_company())
  • Filter: ((__local_69___1.description)::text ~~* '%Anne1 Niels%'::text)
54. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on public_group_company_name_scope_idx (cost=0.00..9.12 rows=78 width=0) (never executed)

  • Index Cond: (__local_69___1.company_id = current_user_company())
55. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public.user_department_group __local_68___1 (cost=9.40..13.67 rows=1 width=32) (never executed)

  • Output: __local_68___1.group_id, __local_68___1.user_id
  • Recheck Cond: ((__local_68___1.group_id = __local_69___1.id) AND (__local_68___1.company_id = current_user_company()))
56. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=9.40..9.40 rows=1 width=0) (never executed)

57. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on user_department_group_group_id_index (cost=0.00..4.33 rows=7 width=0) (never executed)

  • Index Cond: (__local_68___1.group_id = __local_69___1.id)
58. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on user_department_group_company_id_index (cost=0.00..4.81 rows=38 width=0) (never executed)

  • Index Cond: (__local_68___1.company_id = current_user_company())
59. 0.000 0.000 ↓ 0.0 0

Index Scan using user_pkey on public."user" __local_67___1 (cost=0.28..8.65 rows=1 width=16) (never executed)

  • Output: __local_67___1.id
  • Index Cond: (__local_67___1.id = __local_68___1.user_id)
  • Filter: ((policy_superadmin() OR (__local_67___1.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_67___1.id, __local_67___1.departments, __local_67___1.company_id) OR (__local_67___1.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_67___1.id, __local_67___1.departments, __local_67___1.company_id)) OR policy_superadmin() OR (__local_67___1.id = current_user_id())))
60. 0.003 0.362 ↓ 0.0 0 1

Nested Loop Semi Join (cost=0.84..35.19 rows=1 width=0) (actual time=0.362..0.362 rows=0 loops=1)

61. 0.351 0.351 ↑ 1.0 1 1

Index Scan using vw_user_id_company_idx on public."user" __local_70__ (cost=0.28..9.81 rows=1 width=16) (actual time=0.350..0.351 rows=1 loops=1)

  • Output: __local_70__.id
  • Index Cond: (__local_70__.id = __local_1___1.user_id)
  • Filter: ((policy_superadmin() OR (__local_70__.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_70__.id, __local_70__.departments, __local_70__.company_id) OR (__local_70__.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_70__.id, __local_70__.departments, __local_70__.company_id)) OR policy_superadmin() OR (__local_70__.id = current_user_id())))
62. 0.001 0.008 ↓ 0.0 0 1

Nested Loop (cost=0.56..25.37 rows=1 width=16) (actual time=0.008..0.008 rows=0 loops=1)

  • Output: __local_71__.user_id
  • Inner Unique: true
63. 0.007 0.007 ↓ 0.0 0 1

Index Scan using user_company_group_user_id_index on public.user_company_group __local_71__ (cost=0.28..8.55 rows=1 width=32) (actual time=0.007..0.007 rows=0 loops=1)

  • Output: __local_71__.user_id, __local_71__.group_id, __local_71__.company_id
  • Index Cond: (__local_71__.user_id = __local_1___1.user_id)
  • Filter: (__local_71__.company_id = current_user_company())
64. 0.000 0.000 ↓ 0.0 0

Index Scan using group_pkey on public."group" __local_72__ (cost=0.28..8.55 rows=1 width=16) (never executed)

  • Output: __local_72__.id
  • Index Cond: (__local_72__.id = __local_71__.group_id)
  • Filter: ((__local_72__.company_id = current_user_company()) AND ((__local_72__.description)::text ~~* '%Anne1 Niels%'::text))
65. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=77.69..86.40 rows=1 width=16) (never executed)

  • Output: __local_70___1.id
  • Inner Unique: true
66. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=77.40..77.41 rows=1 width=16) (never executed)

  • Output: __local_71___1.user_id
  • Group Key: __local_71___1.user_id
67. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=18.46..77.40 rows=1 width=16) (never executed)

  • Output: __local_71___1.user_id
68. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public."group" __local_72___1 (cost=9.12..63.79 rows=1 width=16) (never executed)

  • Output: __local_72___1.id
  • Recheck Cond: (__local_72___1.company_id = current_user_company())
  • Filter: ((__local_72___1.description)::text ~~* '%Anne1 Niels%'::text)
69. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on public_group_company_name_scope_idx (cost=0.00..9.12 rows=78 width=0) (never executed)

  • Index Cond: (__local_72___1.company_id = current_user_company())
70. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public.user_company_group __local_71___1 (cost=9.34..13.61 rows=1 width=32) (never executed)

  • Output: __local_71___1.user_id, __local_71___1.group_id, __local_71___1.company_id
  • Recheck Cond: ((__local_71___1.group_id = __local_72___1.id) AND (__local_71___1.company_id = current_user_company()))
71. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=9.34..9.34 rows=1 width=0) (never executed)

72. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on user_company_group_group_id_index (cost=0.00..4.34 rows=8 width=0) (never executed)

  • Index Cond: (__local_71___1.group_id = __local_72___1.id)
73. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on user_company_group_company_id_index (cost=0.00..4.75 rows=29 width=0) (never executed)

  • Index Cond: (__local_71___1.company_id = current_user_company())
74. 0.000 0.000 ↓ 0.0 0

Index Scan using user_pkey on public."user" __local_70___1 (cost=0.28..8.98 rows=1 width=16) (never executed)

  • Output: __local_70___1.id
  • Index Cond: (__local_70___1.id = __local_71___1.user_id)
  • Filter: ((policy_superadmin() OR (__local_70___1.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_70___1.id, __local_70___1.departments, __local_70___1.company_id) OR (__local_70___1.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_70___1.id, __local_70___1.departments, __local_70___1.company_id)) OR policy_superadmin() OR (__local_70___1.id = current_user_id())))
75. 0.302 0.302 ↑ 1.0 1 1

Index Scan using vw_user_id_company_idx on public."user" __local_52__ (cost=0.28..9.81 rows=1 width=16) (actual time=0.302..0.302 rows=1 loops=1)

  • Output: __local_52__.id
  • Index Cond: (__local_52__.id = __local_1___1.user_id)
  • Filter: (__local_52__.active AND (policy_superadmin() OR (__local_52__.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_52__.id, __local_52__.departments, __local_52__.company_id) OR (__local_52__.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_52__.id, __local_52__.departments, __local_52__.company_id)) OR policy_superadmin() OR (__local_52__.id = current_user_id())))
76.          

SubPlan (for Nested Loop)

77. 0.652 0.652 ↑ 1.0 1 1

Index Scan using vw_user_id_company_idx on public."user" (cost=0.28..10.06 rows=1 width=32) (actual time=0.651..0.652 rows=1 loops=1)

  • Output: user_first_name("user".*)
  • Index Cond: (__local_1___1.user_id = "user".id)
  • Filter: ((policy_superadmin() OR ("user".company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, "user".id, "user".departments, "user".company_id) OR ("user".is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, "user".id, "user".departments, "user".company_id)) OR policy_superadmin() OR ("user".id = current_user_id())))
78. 0.722 0.722 ↑ 1.0 1 1

Index Scan using vw_user_id_company_idx on public."user" user_1 (cost=0.28..10.06 rows=1 width=32) (actual time=0.721..0.722 rows=1 loops=1)

  • Output: user_last_name(user_1.*)
  • Index Cond: (__local_1___1.user_id = user_1.id)
  • Filter: ((policy_superadmin() OR (user_1.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, user_1.id, user_1.departments, user_1.company_id) OR (user_1.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, user_1.id, user_1.departments, user_1.company_id)) OR policy_superadmin() OR (user_1.id = current_user_id())))
79.          

SubPlan (for WindowAgg)

80. 2.681 2.681 ↑ 1.0 1 1

Function Scan on public.employee_logo __local_2__ (cost=0.25..0.26 rows=1 width=32) (actual time=2.681..2.681 rows=1 loops=1)

  • Output: to_json(__local_2__.__local_2__)
  • Function Call: employee_logo(ROW(__local_1__.id, __local_1__.user_id, __local_1__.active, __local_1__.created_at, __local_1__.updated_at, __local_1__.is_archived, __local_1__.company_id, __local_1__.departments, __local_1__.employment_end, __local_1__.is_leader, __local_1__.leader_departments, __local_1__.group_ids))
81. 0.501 0.501 ↑ 1.0 1 1

Function Scan on public.employee_job_position_title __local_3__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.501..0.501 rows=1 loops=1)

  • Output: to_json(__local_3__.__local_3__)
  • Function Call: employee_job_position_title(ROW(__local_1__.id, __local_1__.user_id, __local_1__.active, __local_1__.created_at, __local_1__.updated_at, __local_1__.is_archived, __local_1__.company_id, __local_1__.departments, __local_1__.employment_end, __local_1__.is_leader, __local_1__.leader_departments, __local_1__.group_ids))
82. 0.425 0.425 ↑ 1.0 1 1

Function Scan on public.employee_job_position_type __local_4__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.425..0.425 rows=1 loops=1)

  • Output: to_json(__local_4__.__local_4__)
  • Function Call: employee_job_position_type(ROW(__local_1__.id, __local_1__.user_id, __local_1__.active, __local_1__.created_at, __local_1__.updated_at, __local_1__.is_archived, __local_1__.company_id, __local_1__.departments, __local_1__.employment_end, __local_1__.is_leader, __local_1__.leader_departments, __local_1__.group_ids))
83. 0.423 0.423 ↑ 1.0 1 1

Function Scan on public.employee_job_position_description __local_5__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.422..0.423 rows=1 loops=1)

  • Output: to_json(__local_5__.__local_5__)
  • Function Call: employee_job_position_description(ROW(__local_1__.id, __local_1__.user_id, __local_1__.active, __local_1__.created_at, __local_1__.updated_at, __local_1__.is_archived, __local_1__.company_id, __local_1__.departments, __local_1__.employment_end, __local_1__.is_leader, __local_1__.leader_departments, __local_1__.group_ids))
84. 0.006 46.472 ↑ 1.0 1 1

Result (cost=958.51..958.52 rows=1 width=32) (actual time=46.472..46.472 rows=1 loops=1)

  • Output: COALESCE($61, '[]'::json)
85.          

Initplan (for Result)

86. 0.038 46.466 ↑ 1.0 1 1

Aggregate (cost=958.50..958.51 rows=1 width=32) (actual time=46.466..46.466 rows=1 loops=1)

  • Output: json_agg(json_build_object('id'::text, __local_7__.id, 'value'::text, __local_7__.value, 'formFieldId'::text, __local_7__.form_field_id, '@formField'::text, (SubPlan 5)))
87. 46.280 46.280 ↑ 25.0 4 1

Function Scan on pg_catalog.unnest __local_7__ (cost=0.25..1.25 rows=100 width=64) (actual time=46.279..46.280 rows=4 loops=1)

  • Output: __local_7__.id, __local_7__.value, __local_7__.form_field_id
  • Function Call: unnest(employee_latest_form_fields_entries(ROW(__local_1__.id, __local_1__.user_id, __local_1__.active, __local_1__.created_at, __local_1__.updated_at, __local_1__.is_archived, __local_1__.company_id, __local_1__.departments, __local_1__.employment_end, __local_1__.is_leader, __local_1__.leader_departments, __local_1__.group_ids)))
88.          

SubPlan (for Aggregate)

89. 0.148 0.148 ↑ 1.0 1 4

Index Scan using form_field_pkey on public.form_field __local_8__ (cost=0.29..9.57 rows=1 width=32) (actual time=0.037..0.037 rows=1 loops=4)

  • Output: json_build_object('sensitive'::text, __local_8__.sensitive)
  • Index Cond: (__local_7__.form_field_id = __local_8__.id)
  • Filter: ((__local_8__.company_id = current_company_id()) AND (((__local_8__.object_type = 'preboarding'::form_field_object_type) AND ((__local_8__.preboarding_assigned_user_ids @> ARRAY[current_user_id()]) OR policy_role_check('app_builder'::text, 'templates'::text, 'read'::text, __local_8__.preboarding_assigned_user_ids, __local_8__.departments, __local_8__.company_id))) OR ((__local_8__.object_type = 'employee'::form_field_object_type) AND (current_user_company() = __local_8__.company_id)) OR policy_restricted_role_check('form_field'::text, 'bytype'::text, 'read'::text, __local_8__.departments, __local_8__.company_id, __local_8__.id)))
90. 0.534 12.531 ↑ 1.0 1 1

Index Scan using vw_user_id_company_idx on public."user" __local_9__ (cost=0.28..139.50 rows=1 width=32) (actual time=12.530..12.531 rows=1 loops=1)

  • Output: json_build_object('id'::text, __local_9__.id, '@firstName'::text, (SubPlan 8), '@lastName'::text, (SubPlan 9), '@fullName'::text, (SubPlan 10), '@email'::text, (SubPlan 11), '@emailWork'::text, (SubPlan 12), '@mobile'::text, (SubPlan 13), '@phone'::text, (SubPlan 14), '@employmentStart'::text, (SubPlan 15), '@employmentEnd'::text, (SubPlan 16), '@birthdate'::text, (SubPlan 17), '@address'::text, (SubPlan 18), '@postalCode'::text, (SubPlan 19), '@city'::text, (SubPlan 20), '@mobilePrivate'::text, (SubPlan 21), 'locale'::text, __local_9__.locale, '@cpr'::text, (SubPlan 22), '@bankRegistrationNumber'::text, (SubPlan 23), '@bankAccountNumber'::text, (SubPlan 24), '@adminDepartments'::text, (SubPlan 29), '@userDepartments'::text, (SubPlan 34), '@userGroups'::text, (SubPlan 39), '@userDepartmentGroups'::text, (SubPlan 45), '@userCompanyGroups'::text, (SubPlan 50))
  • Index Cond: (__local_1__.user_id = __local_9__.id)
  • Filter: ((policy_superadmin() OR (__local_9__.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_9__.id, __local_9__.departments, __local_9__.company_id) OR (__local_9__.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_9__.id, __local_9__.departments, __local_9__.company_id)) OR policy_superadmin() OR (__local_9__.id = current_user_id())))
91.          

SubPlan (for Index Scan)

92. 0.597 0.597 ↑ 1.0 1 1

Function Scan on public.user_first_name __local_10__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.596..0.597 rows=1 loops=1)

  • Output: to_json(__local_10__.__local_10__)
  • Function Call: user_first_name(__local_9__.*)
93. 0.409 0.409 ↑ 1.0 1 1

Function Scan on public.user_last_name __local_11__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.409..0.409 rows=1 loops=1)

  • Output: to_json(__local_11__.__local_11__)
  • Function Call: user_last_name(__local_9__.*)
94. 1.736 1.736 ↑ 1.0 1 1

Function Scan on public.user_full_name __local_12__ (cost=0.25..0.26 rows=1 width=32) (actual time=1.736..1.736 rows=1 loops=1)

  • Output: to_json(__local_12__.__local_12__)
  • Function Call: user_full_name(__local_9__.*)
95. 0.511 0.511 ↑ 1.0 1 1

Function Scan on public.user_email __local_13__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.510..0.511 rows=1 loops=1)

  • Output: to_json(__local_13__.__local_13__)
  • Function Call: user_email(__local_9__.*)
96. 0.329 0.329 ↑ 1.0 1 1

Function Scan on public.user_email_work __local_14__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.329..0.329 rows=1 loops=1)

  • Output: to_json(__local_14__.__local_14__)
  • Function Call: user_email_work(__local_9__.*)
97. 0.293 0.293 ↑ 1.0 1 1

Function Scan on public.user_mobile __local_15__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.293..0.293 rows=1 loops=1)

  • Output: to_json(__local_15__.__local_15__)
  • Function Call: user_mobile(__local_9__.*)
98. 0.288 0.288 ↑ 1.0 1 1

Function Scan on public.user_phone __local_16__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.288..0.288 rows=1 loops=1)

  • Output: to_json(__local_16__.__local_16__)
  • Function Call: user_phone(__local_9__.*)
99. 0.316 0.316 ↑ 1.0 1 1

Function Scan on public.user_employment_start __local_17__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.316..0.316 rows=1 loops=1)

  • Output: to_json(__local_17__.__local_17__)
  • Function Call: user_employment_start(__local_9__.*)
100. 0.293 0.293 ↑ 1.0 1 1

Function Scan on public.user_employment_end __local_18__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.292..0.293 rows=1 loops=1)

  • Output: to_json(__local_18__.__local_18__)
  • Function Call: user_employment_end(__local_9__.*)
101. 2.861 2.861 ↑ 1.0 1 1

Function Scan on public.user_birthdate __local_19__ (cost=0.25..0.26 rows=1 width=32) (actual time=2.861..2.861 rows=1 loops=1)

  • Output: to_json(__local_19__.__local_19__)
  • Function Call: user_birthdate(__local_9__.*)
102. 0.399 0.399 ↑ 1.0 1 1

Function Scan on public.user_address __local_20__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.399..0.399 rows=1 loops=1)

  • Output: to_json(__local_20__.__local_20__)
  • Function Call: user_address(__local_9__.*)
103. 0.408 0.408 ↑ 1.0 1 1

Function Scan on public.user_postal_code __local_21__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.407..0.408 rows=1 loops=1)

  • Output: to_json(__local_21__.__local_21__)
  • Function Call: user_postal_code(__local_9__.*)
104. 0.401 0.401 ↑ 1.0 1 1

Function Scan on public.user_city __local_22__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.401..0.401 rows=1 loops=1)

  • Output: to_json(__local_22__.__local_22__)
  • Function Call: user_city(__local_9__.*)
105. 0.452 0.452 ↑ 1.0 1 1

Function Scan on public.user_mobile_private __local_23__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.452..0.452 rows=1 loops=1)

  • Output: to_json(__local_23__.__local_23__)
  • Function Call: user_mobile_private(__local_9__.*)
106. 0.603 0.603 ↑ 1.0 1 1

Function Scan on public.user_cpr __local_24__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.603..0.603 rows=1 loops=1)

  • Output: to_json(__local_24__.__local_24__)
  • Function Call: user_cpr(__local_9__.*)
107. 0.601 0.601 ↑ 1.0 1 1

Function Scan on public.user_bank_registration_number __local_25__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.601..0.601 rows=1 loops=1)

  • Output: to_json(__local_25__.__local_25__)
  • Function Call: user_bank_registration_number(__local_9__.*)
108. 0.413 0.413 ↑ 1.0 1 1

Function Scan on public.user_bank_account_number __local_26__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.413..0.413 rows=1 loops=1)

  • Output: to_json(__local_26__.__local_26__)
  • Function Call: user_bank_account_number(__local_9__.*)
109. 0.007 0.066 ↑ 1.0 1 1

Result (cost=12.78..12.79 rows=1 width=32) (actual time=0.066..0.066 rows=1 loops=1)

  • Output: json_build_object('data'::text, COALESCE($83, '[]'::json))
110.          

CTE __local_27__

111. 0.001 0.052 ↓ 0.0 0 1

Subquery Scan on __local_28__ (cost=3.88..12.72 rows=1 width=32) (actual time=0.052..0.052 rows=0 loops=1)

  • Output: to_json(json_build_object('@node'::text, json_build_object('departmentId'::text, __local_28__.department_id, '@department'::text, (SubPlan 25))))
112. 0.026 0.051 ↓ 0.0 0 1

Sort (cost=3.88..3.89 rows=1 width=32) (actual time=0.051..0.051 rows=0 loops=1)

  • Output: __local_28___1.user_id, __local_28___1.department_id
  • Sort Key: __local_28___1.department_id
  • Sort Method: quicksort Memory: 25kB
113. 0.025 0.025 ↓ 0.0 0 1

Seq Scan on public.admin_department __local_28___1 (cost=0.00..3.88 rows=1 width=32) (actual time=0.024..0.025 rows=0 loops=1)

  • Output: __local_28___1.user_id, __local_28___1.department_id
  • Filter: (false AND (__local_28___1.user_id = __local_9__.id))
  • Rows Removed by Filter: 170
114.          

SubPlan (for Subquery Scan)

115. 0.000 0.000 ↓ 0.0 0

Index Scan using department_id_company_idx on public.department __local_29__ (cost=0.28..8.81 rows=1 width=32) (never executed)

  • Output: json_build_object('id'::text, __local_29__.id, 'name'::text, __local_29__.name)
  • Index Cond: (__local_28__.department_id = __local_29__.id)
  • Filter: (policy_role_check('department'::text, 'general'::text, 'read'::text, NULL::uuid, __local_29__.id, __local_29__.company_id) OR (__local_29__.id = ANY (current_user_departments())))
116.          

CTE __local_30__

117. 0.004 0.057 ↑ 1.0 1 1

Aggregate (cost=0.03..0.04 rows=1 width=32) (actual time=0.056..0.057 rows=1 loops=1)

  • Output: json_agg(to_json(__local_27__.*))
118. 0.053 0.053 ↓ 0.0 0 1

CTE Scan on __local_27__ (cost=0.00..0.02 rows=1 width=24) (actual time=0.053..0.053 rows=0 loops=1)

  • Output: __local_27__.*
119.          

Initplan (for Result)

120. 0.059 0.059 ↑ 1.0 1 1

CTE Scan on __local_30__ (cost=0.00..0.02 rows=1 width=32) (actual time=0.059..0.059 rows=1 loops=1)

  • Output: __local_30__.data
121. 0.005 0.582 ↑ 1.0 1 1

Result (cost=26.03..26.04 rows=1 width=32) (actual time=0.582..0.582 rows=1 loops=1)

  • Output: json_build_object('data'::text, COALESCE($89, '[]'::json))
122.          

CTE __local_31__

123. 0.010 0.563 ↑ 1.0 1 1

Subquery Scan on __local_32__ (cost=0.56..25.97 rows=1 width=32) (actual time=0.562..0.563 rows=1 loops=1)

  • Output: to_json(json_build_object('@node'::text, json_build_object('departmentId'::text, __local_32__.department_id, '@department'::text, (SubPlan 30))))
124. 0.005 0.326 ↑ 1.0 1 1

Nested Loop (cost=0.56..17.14 rows=1 width=64) (actual time=0.325..0.326 rows=1 loops=1)

  • Output: __local_32___1.user_id, __local_32___1.department_id, NULL::uuid, NULL::uuid
  • Inner Unique: true
125. 0.014 0.014 ↑ 1.0 1 1

Index Only Scan using user_department_pkey on public.user_department __local_32___1 (cost=0.28..8.30 rows=1 width=32) (actual time=0.014..0.014 rows=1 loops=1)

  • Output: __local_32___1.user_id, __local_32___1.department_id
  • Index Cond: (__local_32___1.user_id = __local_9__.id)
  • Heap Fetches: 1
126. 0.307 0.307 ↑ 1.0 1 1

Index Scan using department_id_company_idx on public.department __local_34__ (cost=0.28..8.81 rows=1 width=16) (actual time=0.307..0.307 rows=1 loops=1)

  • Output: __local_34__.id, __local_34__.company_id, __local_34__.main_department, __local_34__.alias, __local_34__.name, __local_34__.description, __local_34__.p_number, __local_34__.ean, __local_34__.active, __local_34__.delete_at, __local_34__.phone, __local_34__.email, __local_34__.address, __local_34__.city, __local_34__.postal_code, __local_34__.country, __local_34__.created_at, __local_34__.updated_at, __local_34__.cvr, __local_34__.parent_department_id
  • Index Cond: (__local_34__.id = __local_32___1.department_id)
  • Filter: (__local_34__.active AND (policy_role_check('department'::text, 'general'::text, 'read'::text, NULL::uuid, __local_34__.id, __local_34__.company_id) OR (__local_34__.id = ANY (current_user_departments()))))
127.          

SubPlan (for Subquery Scan)

128. 0.227 0.227 ↑ 1.0 1 1

Index Scan using department_id_company_idx on public.department __local_33__ (cost=0.28..8.81 rows=1 width=32) (actual time=0.225..0.227 rows=1 loops=1)

  • Output: json_build_object('id'::text, __local_33__.id, 'name'::text, __local_33__.name)
  • Index Cond: (__local_32__.department_id = __local_33__.id)
  • Filter: (policy_role_check('department'::text, 'general'::text, 'read'::text, NULL::uuid, __local_33__.id, __local_33__.company_id) OR (__local_33__.id = ANY (current_user_departments())))
129.          

CTE __local_35__

130. 0.006 0.575 ↑ 1.0 1 1

Aggregate (cost=0.03..0.04 rows=1 width=32) (actual time=0.575..0.575 rows=1 loops=1)

  • Output: json_agg(to_json(__local_31__.*))
131. 0.569 0.569 ↑ 1.0 1 1

CTE Scan on __local_31__ (cost=0.00..0.02 rows=1 width=24) (actual time=0.567..0.569 rows=1 loops=1)

  • Output: __local_31__.*
132.          

Initplan (for Result)

133. 0.577 0.577 ↑ 1.0 1 1

CTE Scan on __local_35__ (cost=0.00..0.02 rows=1 width=32) (actual time=0.577..0.577 rows=1 loops=1)

  • Output: __local_35__.data
134. 0.003 0.173 ↑ 1.0 1 1

Result (cost=25.68..25.69 rows=1 width=32) (actual time=0.173..0.173 rows=1 loops=1)

  • Output: json_build_object('data'::text, COALESCE($95, '[]'::json))
135.          

CTE __local_36__

136. 0.013 0.155 ↓ 2.0 2 1

Subquery Scan on __local_38__ (cost=0.56..25.62 rows=1 width=32) (actual time=0.125..0.155 rows=2 loops=1)

  • Output: to_json(json_build_object('@node'::text, json_build_object('@group'::text, (SubPlan 35))))
137. 0.005 0.066 ↓ 2.0 2 1

Nested Loop (cost=0.56..17.05 rows=1 width=48) (actual time=0.050..0.066 rows=2 loops=1)

  • Output: __local_38___1.user_id, __local_38___1.group_id, NULL::uuid
  • Inner Unique: true
138. 0.013 0.013 ↓ 3.0 3 1

Index Only Scan using user_group_pkey on public.user_group __local_38___1 (cost=0.28..8.29 rows=1 width=32) (actual time=0.011..0.013 rows=3 loops=1)

  • Output: __local_38___1.user_id, __local_38___1.group_id
  • Index Cond: (__local_38___1.user_id = __local_9__.id)
  • Heap Fetches: 3
139. 0.048 0.048 ↑ 1.0 1 3

Index Scan using group_pkey on public."group" __local_39__ (cost=0.28..8.55 rows=1 width=16) (actual time=0.016..0.016 rows=1 loops=3)

  • Output: __local_39__.id
  • Index Cond: (__local_39__.id = __local_38___1.group_id)
  • Filter: (__local_39__.active AND (__local_39__.company_id = current_user_company()))
  • Rows Removed by Filter: 0
140.          

SubPlan (for Subquery Scan)

141. 0.076 0.076 ↑ 1.0 1 2

Index Scan using group_pkey on public."group" __local_37__ (cost=0.28..8.55 rows=1 width=32) (actual time=0.038..0.038 rows=1 loops=2)

  • Output: json_build_object('id'::text, __local_37__.id, 'description'::text, __local_37__.description, 'scope'::text, __local_37__.scope)
  • Index Cond: (__local_38__.group_id = __local_37__.id)
  • Filter: (__local_37__.company_id = current_user_company())
142.          

CTE __local_40__

143. 0.006 0.166 ↑ 1.0 1 1

Aggregate (cost=0.03..0.04 rows=1 width=32) (actual time=0.166..0.166 rows=1 loops=1)

  • Output: json_agg(to_json(__local_36__.*))
144. 0.160 0.160 ↓ 2.0 2 1

CTE Scan on __local_36__ (cost=0.00..0.02 rows=1 width=24) (actual time=0.128..0.160 rows=2 loops=1)

  • Output: __local_36__.*
145.          

Initplan (for Result)

146. 0.170 0.170 ↑ 1.0 1 1

CTE Scan on __local_40__ (cost=0.00..0.02 rows=1 width=32) (actual time=0.169..0.170 rows=1 loops=1)

  • Output: __local_40__.data
147. 0.005 0.016 ↑ 1.0 1 1

Result (cost=34.74..34.76 rows=1 width=32) (actual time=0.016..0.016 rows=1 loops=1)

  • Output: json_build_object('data'::text, COALESCE($102, '[]'::json))
148.          

CTE __local_41__

149. 0.001 0.006 ↓ 0.0 0 1

Subquery Scan on __local_43__ (cost=0.56..34.69 rows=1 width=32) (actual time=0.006..0.006 rows=0 loops=1)

  • Output: to_json(json_build_object('@node'::text, json_build_object('@group'::text, (SubPlan 40), '@department'::text, (SubPlan 41))))
150. 0.001 0.005 ↓ 0.0 0 1

Nested Loop (cost=0.56..17.31 rows=1 width=65) (actual time=0.005..0.005 rows=0 loops=1)

  • Output: __local_43___1.user_id, __local_43___1.department_id, __local_43___1.group_id, NULL::uuid, NULL::boolean
  • Inner Unique: true
151. 0.004 0.004 ↓ 0.0 0 1

Index Scan using user_department_group_pkey on public.user_department_group __local_43___1 (cost=0.28..8.55 rows=1 width=48) (actual time=0.004..0.004 rows=0 loops=1)

  • Output: __local_43___1.user_id, __local_43___1.department_id, __local_43___1.group_id
  • Index Cond: (__local_43___1.user_id = __local_9__.id)
  • Filter: (__local_43___1.company_id = current_user_company())
152. 0.000 0.000 ↓ 0.0 0

Index Scan using group_pkey on public."group" __local_45__ (cost=0.28..8.55 rows=1 width=16) (never executed)

  • Output: __local_45__.id
  • Index Cond: (__local_45__.id = __local_43___1.group_id)
  • Filter: (__local_45__.active AND (__local_45__.company_id = current_user_company()))
153.          

SubPlan (for Subquery Scan)

154. 0.000 0.000 ↓ 0.0 0

Index Scan using group_pkey on public."group" __local_42__ (cost=0.28..8.55 rows=1 width=32) (never executed)

  • Output: json_build_object('id'::text, __local_42__.id, 'description'::text, __local_42__.description, 'scope'::text, __local_42__.scope)
  • Index Cond: (__local_43__.group_id = __local_42__.id)
  • Filter: (__local_42__.company_id = current_user_company())
155. 0.000 0.000 ↓ 0.0 0

Index Scan using department_id_company_idx on public.department __local_44__ (cost=0.28..8.81 rows=1 width=32) (never executed)

  • Output: json_build_object('id'::text, __local_44__.id, 'name'::text, __local_44__.name)
  • Index Cond: (__local_43__.department_id = __local_44__.id)
  • Filter: (policy_role_check('department'::text, 'general'::text, 'read'::text, NULL::uuid, __local_44__.id, __local_44__.company_id) OR (__local_44__.id = ANY (current_user_departments())))
156.          

CTE __local_46__

157. 0.001 0.009 ↑ 1.0 1 1

Aggregate (cost=0.03..0.04 rows=1 width=32) (actual time=0.009..0.009 rows=1 loops=1)

  • Output: json_agg(to_json(__local_41__.*))
158. 0.008 0.008 ↓ 0.0 0 1

CTE Scan on __local_41__ (cost=0.00..0.02 rows=1 width=24) (actual time=0.008..0.008 rows=0 loops=1)

  • Output: __local_41__.*
159.          

Initplan (for Result)

160. 0.011 0.011 ↑ 1.0 1 1

CTE Scan on __local_46__ (cost=0.00..0.02 rows=1 width=32) (actual time=0.011..0.011 rows=1 loops=1)

  • Output: __local_46__.data
161. 0.005 0.250 ↑ 1.0 1 1

Result (cost=25.93..25.95 rows=1 width=32) (actual time=0.250..0.250 rows=1 loops=1)

  • Output: json_build_object('data'::text, COALESCE($108, '[]'::json))
162.          

CTE __local_47__

163. 0.019 0.223 ↓ 5.0 5 1

Subquery Scan on __local_49__ (cost=0.81..25.88 rows=1 width=32) (actual time=0.137..0.223 rows=5 loops=1)

  • Output: to_json(json_build_object('@node'::text, json_build_object('@group'::text, (SubPlan 46))))
164. 0.033 0.109 ↓ 5.0 5 1

Nested Loop (cost=0.81..17.31 rows=1 width=48) (actual time=0.072..0.109 rows=5 loops=1)

  • Output: __local_49___1.user_id, __local_49___1.group_id, __local_49___1.company_id
  • Inner Unique: true
165. 0.011 0.011 ↓ 5.0 5 1

Index Only Scan using user_company_group_pkey on public.user_company_group __local_49___1 (cost=0.53..8.55 rows=1 width=48) (actual time=0.009..0.011 rows=5 loops=1)

  • Output: __local_49___1.user_id, __local_49___1.group_id, __local_49___1.company_id
  • Index Cond: ((__local_49___1.user_id = __local_9__.id) AND (__local_49___1.company_id = current_user_company()))
  • Heap Fetches: 5
166. 0.065 0.065 ↑ 1.0 1 5

Index Scan using group_pkey on public."group" __local_50__ (cost=0.28..8.55 rows=1 width=16) (actual time=0.013..0.013 rows=1 loops=5)

  • Output: __local_50__.id
  • Index Cond: (__local_50__.id = __local_49___1.group_id)
  • Filter: (__local_50__.active AND (__local_50__.company_id = current_user_company()))
167.          

SubPlan (for Subquery Scan)

168. 0.095 0.095 ↑ 1.0 1 5

Index Scan using group_pkey on public."group" __local_48__ (cost=0.28..8.55 rows=1 width=32) (actual time=0.019..0.019 rows=1 loops=5)

  • Output: json_build_object('id'::text, __local_48__.id, 'description'::text, __local_48__.description, 'scope'::text, __local_48__.scope)
  • Index Cond: (__local_49__.group_id = __local_48__.id)
  • Filter: (__local_48__.company_id = current_user_company())
169.          

CTE __local_51__

170. 0.010 0.240 ↑ 1.0 1 1

Aggregate (cost=0.03..0.04 rows=1 width=32) (actual time=0.240..0.240 rows=1 loops=1)

  • Output: json_agg(to_json(__local_47__.*))
171. 0.230 0.230 ↓ 5.0 5 1

CTE Scan on __local_47__ (cost=0.00..0.02 rows=1 width=24) (actual time=0.141..0.230 rows=5 loops=1)

  • Output: __local_47__.*
172.          

Initplan (for Result)

173. 0.245 0.245 ↑ 1.0 1 1

CTE Scan on __local_51__ (cost=0.00..0.02 rows=1 width=32) (actual time=0.244..0.245 rows=1 loops=1)

  • Output: __local_51__.data
174.          

CTE __local_73__

175. 0.022 141.617 ↑ 1.0 1 1

Aggregate (cost=0.03..0.04 rows=1 width=32) (actual time=141.617..141.617 rows=1 loops=1)

  • Output: json_agg(to_json(__local_0__.*))
176. 141.595 141.595 ↑ 1.0 1 1

CTE Scan on __local_0__ (cost=0.00..0.02 rows=1 width=24) (actual time=141.591..141.595 rows=1 loops=1)

  • Output: __local_0__.*
177.          

Initplan (for Result)

178. 141.623 141.623 ↑ 1.0 1 1

CTE Scan on __local_73__ (cost=0.00..0.02 rows=1 width=32) (actual time=141.623..141.623 rows=1 loops=1)

  • Output: __local_73__.data
179. 0.001 72.433 ↓ 0.0 0 1

Limit (cost=216,475.08..216,475.08 rows=1 width=4) (actual time=72.433..72.433 rows=0 loops=1)

  • Output: 1
180. 0.005 72.432 ↑ 1.0 1 1

Nested Loop (cost=0.53..216,475.08 rows=1 width=4) (actual time=65.563..72.432 rows=1 loops=1)

  • Output: 1
  • Inner Unique: true
181. 63.160 72.172 ↑ 1.0 1 1

Function Scan on public.employees_search __local_1___2 (cost=0.25..216,465.25 rows=1 width=16) (actual time=65.305..72.172 rows=1 loops=1)

  • Output: __local_1___2.user_id
  • Function Call: employees_search('Anne1 Niels'::text)
  • Filter: (__local_1___2.active AND ((__local_1___2.employment_end IS NULL) OR (__local_1___2.employment_end > '2020-02-05'::date)) AND (__local_1___2.company_id = '47d08a0b-2c1b-4591-acc0-4d521915c8ef'::uuid) AND (((__local_1___2.employment_end IS NULL) AND ((employee_job_position_title(__local_1___2.*))::text ~~* '%Anne1 Niels%'::text)) OR ((__local_1___2.employment_end > '2020-02-05'::date) AND (employee_job_position_description(__local_1___2.*) ~~* '%Anne1 Niels%'::text)) OR (alternatives: SubPlan 85 or hashed SubPlan 86) OR (alternatives: SubPlan 87 or hashed SubPlan 88) OR (alternatives: SubPlan 89 or hashed SubPlan 90) OR (alternatives: SubPlan 91 or hashed SubPlan 92) OR (alternatives: SubPlan 93 or hashed SubPlan 94) OR (alternatives: SubPlan 95 or hashed SubPlan 96) OR (alternatives: SubPlan 97 or hashed SubPlan 98) OR (alternatives: SubPlan 99 or hashed SubPlan 100) OR (alternatives: SubPlan 101 or hashed SubPlan 102) OR (alternatives: SubPlan 103 or hashed SubPlan 104) OR (alternatives: SubPlan 105 or hashed SubPlan 106) OR (alternatives: SubPlan 107 or hashed SubPlan 108) OR (alternatives: SubPlan 109 or hashed SubPlan 110) OR (alternatives: SubPlan 111 or hashed SubPlan 112)))
  • Rows Removed by Filter: 1
182.          

SubPlan (for Function Scan)

183. 0.768 0.768 ↓ 0.0 0 2

Index Scan using vw_user_id_company_idx on public."user" __local_53___2 (cost=0.28..10.06 rows=1 width=0) (actual time=0.384..0.384 rows=0 loops=2)

  • Index Cond: (__local_1___2.user_id = __local_53___2.id)
  • Filter: ((policy_superadmin() OR (__local_53___2.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_53___2.id, __local_53___2.departments, __local_53___2.company_id) OR (__local_53___2.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_53___2.id, __local_53___2.departments, __local_53___2.company_id)) OR policy_superadmin() OR (__local_53___2.id = current_user_id())) AND ((user_first_name(__local_53___2.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
184. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_53___3 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_53___3.id
  • Filter: ((policy_superadmin() OR (__local_53___3.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_53___3.id, __local_53___3.departments, __local_53___3.company_id) OR (__local_53___3.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_53___3.id, __local_53___3.departments, __local_53___3.company_id)) OR policy_superadmin() OR (__local_53___3.id = current_user_id())) AND ((user_first_name(__local_53___3.*))::text ~~* '%Anne1 Niels%'::text))
185. 0.978 0.978 ↓ 0.0 0 2

Index Scan using vw_user_id_company_idx on public."user" __local_54___2 (cost=0.28..10.06 rows=1 width=0) (actual time=0.489..0.489 rows=0 loops=2)

  • Index Cond: (__local_1___2.user_id = __local_54___2.id)
  • Filter: ((policy_superadmin() OR (__local_54___2.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_54___2.id, __local_54___2.departments, __local_54___2.company_id) OR (__local_54___2.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_54___2.id, __local_54___2.departments, __local_54___2.company_id)) OR policy_superadmin() OR (__local_54___2.id = current_user_id())) AND ((user_last_name(__local_54___2.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
186. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_54___3 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_54___3.id
  • Filter: ((policy_superadmin() OR (__local_54___3.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_54___3.id, __local_54___3.departments, __local_54___3.company_id) OR (__local_54___3.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_54___3.id, __local_54___3.departments, __local_54___3.company_id)) OR policy_superadmin() OR (__local_54___3.id = current_user_id())) AND ((user_last_name(__local_54___3.*))::text ~~* '%Anne1 Niels%'::text))
187. 1.328 1.328 ↓ 0.0 0 2

Index Scan using vw_user_id_company_idx on public."user" __local_55___2 (cost=0.28..10.06 rows=1 width=0) (actual time=0.664..0.664 rows=0 loops=2)

  • Index Cond: (__local_1___2.user_id = __local_55___2.id)
  • Filter: ((policy_superadmin() OR (__local_55___2.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_55___2.id, __local_55___2.departments, __local_55___2.company_id) OR (__local_55___2.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_55___2.id, __local_55___2.departments, __local_55___2.company_id)) OR policy_superadmin() OR (__local_55___2.id = current_user_id())) AND ((user_full_name(__local_55___2.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 0
188. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_55___3 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_55___3.id
  • Filter: ((policy_superadmin() OR (__local_55___3.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_55___3.id, __local_55___3.departments, __local_55___3.company_id) OR (__local_55___3.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_55___3.id, __local_55___3.departments, __local_55___3.company_id)) OR policy_superadmin() OR (__local_55___3.id = current_user_id())) AND ((user_full_name(__local_55___3.*))::text ~~* '%Anne1 Niels%'::text))
189. 0.734 0.734 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_56___2 (cost=0.28..10.06 rows=1 width=0) (actual time=0.734..0.734 rows=0 loops=1)

  • Index Cond: (__local_1___2.user_id = __local_56___2.id)
  • Filter: ((policy_superadmin() OR (__local_56___2.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_56___2.id, __local_56___2.departments, __local_56___2.company_id) OR (__local_56___2.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_56___2.id, __local_56___2.departments, __local_56___2.company_id)) OR policy_superadmin() OR (__local_56___2.id = current_user_id())) AND ((user_email(__local_56___2.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
190. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_56___3 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_56___3.id
  • Filter: ((policy_superadmin() OR (__local_56___3.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_56___3.id, __local_56___3.departments, __local_56___3.company_id) OR (__local_56___3.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_56___3.id, __local_56___3.departments, __local_56___3.company_id)) OR policy_superadmin() OR (__local_56___3.id = current_user_id())) AND ((user_email(__local_56___3.*))::text ~~* '%Anne1 Niels%'::text))
191. 0.575 0.575 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_57___2 (cost=0.28..10.06 rows=1 width=0) (actual time=0.575..0.575 rows=0 loops=1)

  • Index Cond: (__local_1___2.user_id = __local_57___2.id)
  • Filter: ((policy_superadmin() OR (__local_57___2.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_57___2.id, __local_57___2.departments, __local_57___2.company_id) OR (__local_57___2.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_57___2.id, __local_57___2.departments, __local_57___2.company_id)) OR policy_superadmin() OR (__local_57___2.id = current_user_id())) AND ((user_email_work(__local_57___2.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
192. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_57___3 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_57___3.id
  • Filter: ((policy_superadmin() OR (__local_57___3.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_57___3.id, __local_57___3.departments, __local_57___3.company_id) OR (__local_57___3.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_57___3.id, __local_57___3.departments, __local_57___3.company_id)) OR policy_superadmin() OR (__local_57___3.id = current_user_id())) AND ((user_email_work(__local_57___3.*))::text ~~* '%Anne1 Niels%'::text))
193. 0.562 0.562 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_58___2 (cost=0.28..10.06 rows=1 width=0) (actual time=0.562..0.562 rows=0 loops=1)

  • Index Cond: (__local_1___2.user_id = __local_58___2.id)
  • Filter: ((policy_superadmin() OR (__local_58___2.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_58___2.id, __local_58___2.departments, __local_58___2.company_id) OR (__local_58___2.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_58___2.id, __local_58___2.departments, __local_58___2.company_id)) OR policy_superadmin() OR (__local_58___2.id = current_user_id())) AND ((user_phone(__local_58___2.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
194. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_58___3 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_58___3.id
  • Filter: ((policy_superadmin() OR (__local_58___3.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_58___3.id, __local_58___3.departments, __local_58___3.company_id) OR (__local_58___3.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_58___3.id, __local_58___3.departments, __local_58___3.company_id)) OR policy_superadmin() OR (__local_58___3.id = current_user_id())) AND ((user_phone(__local_58___3.*))::text ~~* '%Anne1 Niels%'::text))
195. 0.805 0.805 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_59___2 (cost=0.28..10.06 rows=1 width=0) (actual time=0.805..0.805 rows=0 loops=1)

  • Index Cond: (__local_1___2.user_id = __local_59___2.id)
  • Filter: ((policy_superadmin() OR (__local_59___2.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_59___2.id, __local_59___2.departments, __local_59___2.company_id) OR (__local_59___2.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_59___2.id, __local_59___2.departments, __local_59___2.company_id)) OR policy_superadmin() OR (__local_59___2.id = current_user_id())) AND ((user_mobile(__local_59___2.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
196. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_59___3 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_59___3.id
  • Filter: ((policy_superadmin() OR (__local_59___3.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_59___3.id, __local_59___3.departments, __local_59___3.company_id) OR (__local_59___3.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_59___3.id, __local_59___3.departments, __local_59___3.company_id)) OR policy_superadmin() OR (__local_59___3.id = current_user_id())) AND ((user_mobile(__local_59___3.*))::text ~~* '%Anne1 Niels%'::text))
197. 0.561 0.561 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_60___2 (cost=0.28..10.06 rows=1 width=0) (actual time=0.561..0.561 rows=0 loops=1)

  • Index Cond: (__local_1___2.user_id = __local_60___2.id)
  • Filter: ((policy_superadmin() OR (__local_60___2.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_60___2.id, __local_60___2.departments, __local_60___2.company_id) OR (__local_60___2.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_60___2.id, __local_60___2.departments, __local_60___2.company_id)) OR policy_superadmin() OR (__local_60___2.id = current_user_id())) AND ((user_address(__local_60___2.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
198. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_60___3 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_60___3.id
  • Filter: ((policy_superadmin() OR (__local_60___3.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_60___3.id, __local_60___3.departments, __local_60___3.company_id) OR (__local_60___3.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_60___3.id, __local_60___3.departments, __local_60___3.company_id)) OR policy_superadmin() OR (__local_60___3.id = current_user_id())) AND ((user_address(__local_60___3.*))::text ~~* '%Anne1 Niels%'::text))
199. 0.565 0.565 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_61___2 (cost=0.28..10.06 rows=1 width=0) (actual time=0.565..0.565 rows=0 loops=1)

  • Index Cond: (__local_1___2.user_id = __local_61___2.id)
  • Filter: ((policy_superadmin() OR (__local_61___2.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_61___2.id, __local_61___2.departments, __local_61___2.company_id) OR (__local_61___2.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_61___2.id, __local_61___2.departments, __local_61___2.company_id)) OR policy_superadmin() OR (__local_61___2.id = current_user_id())) AND ((user_city(__local_61___2.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
200. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_61___3 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_61___3.id
  • Filter: ((policy_superadmin() OR (__local_61___3.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_61___3.id, __local_61___3.departments, __local_61___3.company_id) OR (__local_61___3.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_61___3.id, __local_61___3.departments, __local_61___3.company_id)) OR policy_superadmin() OR (__local_61___3.id = current_user_id())) AND ((user_city(__local_61___3.*))::text ~~* '%Anne1 Niels%'::text))
201. 0.560 0.560 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_62___2 (cost=0.28..10.06 rows=1 width=0) (actual time=0.560..0.560 rows=0 loops=1)

  • Index Cond: (__local_1___2.user_id = __local_62___2.id)
  • Filter: ((policy_superadmin() OR (__local_62___2.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_62___2.id, __local_62___2.departments, __local_62___2.company_id) OR (__local_62___2.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_62___2.id, __local_62___2.departments, __local_62___2.company_id)) OR policy_superadmin() OR (__local_62___2.id = current_user_id())) AND ((user_postal_code(__local_62___2.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
202. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_62___3 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_62___3.id
  • Filter: ((policy_superadmin() OR (__local_62___3.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_62___3.id, __local_62___3.departments, __local_62___3.company_id) OR (__local_62___3.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_62___3.id, __local_62___3.departments, __local_62___3.company_id)) OR policy_superadmin() OR (__local_62___3.id = current_user_id())) AND ((user_postal_code(__local_62___3.*))::text ~~* '%Anne1 Niels%'::text))
203. 0.680 0.680 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_63___2 (cost=0.28..10.06 rows=1 width=0) (actual time=0.680..0.680 rows=0 loops=1)

  • Index Cond: (__local_1___2.user_id = __local_63___2.id)
  • Filter: ((policy_superadmin() OR (__local_63___2.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_63___2.id, __local_63___2.departments, __local_63___2.company_id) OR (__local_63___2.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_63___2.id, __local_63___2.departments, __local_63___2.company_id)) OR policy_superadmin() OR (__local_63___2.id = current_user_id())) AND ((user_country(__local_63___2.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
204. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_63___3 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_63___3.id
  • Filter: ((policy_superadmin() OR (__local_63___3.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_63___3.id, __local_63___3.departments, __local_63___3.company_id) OR (__local_63___3.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_63___3.id, __local_63___3.departments, __local_63___3.company_id)) OR policy_superadmin() OR (__local_63___3.id = current_user_id())) AND ((user_country(__local_63___3.*))::text ~~* '%Anne1 Niels%'::text))
205. 0.002 0.343 ↓ 0.0 0 1

Nested Loop Semi Join (cost=0.84..34.94 rows=1 width=0) (actual time=0.343..0.343 rows=0 loops=1)

206. 0.280 0.280 ↑ 1.0 1 1

Index Scan using vw_user_id_company_idx on public."user" __local_64___2 (cost=0.28..9.81 rows=1 width=16) (actual time=0.279..0.280 rows=1 loops=1)

  • Output: __local_64___2.id
  • Index Cond: (__local_64___2.id = __local_1___2.user_id)
  • Filter: ((policy_superadmin() OR (__local_64___2.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_64___2.id, __local_64___2.departments, __local_64___2.company_id) OR (__local_64___2.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_64___2.id, __local_64___2.departments, __local_64___2.company_id)) OR policy_superadmin() OR (__local_64___2.id = current_user_id())))
207. 0.002 0.061 ↓ 0.0 0 1

Nested Loop (cost=0.56..25.12 rows=1 width=16) (actual time=0.061..0.061 rows=0 loops=1)

  • Output: __local_65___2.user_id
  • Inner Unique: true
208. 0.011 0.011 ↓ 2.0 2 1

Index Only Scan using user_group_pkey on public.user_group __local_65___2 (cost=0.28..8.29 rows=1 width=32) (actual time=0.008..0.011 rows=2 loops=1)

  • Output: __local_65___2.user_id, __local_65___2.group_id
  • Index Cond: (__local_65___2.user_id = __local_1___2.user_id)
  • Heap Fetches: 2
209. 0.048 0.048 ↓ 0.0 0 2

Index Scan using group_pkey on public."group" __local_66___2 (cost=0.28..8.55 rows=1 width=16) (actual time=0.024..0.024 rows=0 loops=2)

  • Output: __local_66___2.id
  • Index Cond: (__local_66___2.id = __local_65___2.group_id)
  • Filter: ((__local_66___2.company_id = current_user_company()) AND ((__local_66___2.description)::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
210. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=96.91..100.07 rows=1 width=16) (never executed)

  • Output: __local_64___3.id
  • Inner Unique: true
211. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=96.63..96.64 rows=1 width=16) (never executed)

  • Output: __local_65___3.user_id
  • Group Key: __local_65___3.user_id
212. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=63.80..96.62 rows=1 width=16) (never executed)

  • Output: __local_65___3.user_id
  • Inner Unique: true
  • Hash Cond: (__local_65___3.group_id = __local_66___3.id)
213. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.user_group __local_65___3 (cost=0.00..29.11 rows=1,411 width=32) (never executed)

  • Output: __local_65___3.user_id, __local_65___3.group_id, __local_65___3.company_id
214. 0.000 0.000 ↓ 0.0 0

Hash (cost=63.79..63.79 rows=1 width=16) (never executed)

  • Output: __local_66___3.id
215. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public."group" __local_66___3 (cost=9.12..63.79 rows=1 width=16) (never executed)

  • Output: __local_66___3.id
  • Recheck Cond: (__local_66___3.company_id = current_user_company())
  • Filter: ((__local_66___3.description)::text ~~* '%Anne1 Niels%'::text)
216. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on public_group_company_name_scope_idx (cost=0.00..9.12 rows=78 width=0) (never executed)

  • Index Cond: (__local_66___3.company_id = current_user_company())
217. 0.000 0.000 ↓ 0.0 0

Index Scan using user_pkey on public."user" __local_64___3 (cost=0.28..3.43 rows=1 width=16) (never executed)

  • Output: __local_64___3.id
  • Index Cond: (__local_64___3.id = __local_65___3.user_id)
  • Filter: ((policy_superadmin() OR (__local_64___3.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_64___3.id, __local_64___3.departments, __local_64___3.company_id) OR (__local_64___3.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_64___3.id, __local_64___3.departments, __local_64___3.company_id)) OR policy_superadmin() OR (__local_64___3.id = current_user_id())))
218. 0.002 0.282 ↓ 0.0 0 1

Nested Loop Semi Join (cost=0.84..35.19 rows=1 width=0) (actual time=0.282..0.282 rows=0 loops=1)

219. 0.274 0.274 ↑ 1.0 1 1

Index Scan using vw_user_id_company_idx on public."user" __local_67___2 (cost=0.28..9.81 rows=1 width=16) (actual time=0.274..0.274 rows=1 loops=1)

  • Output: __local_67___2.id
  • Index Cond: (__local_67___2.id = __local_1___2.user_id)
  • Filter: ((policy_superadmin() OR (__local_67___2.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_67___2.id, __local_67___2.departments, __local_67___2.company_id) OR (__local_67___2.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_67___2.id, __local_67___2.departments, __local_67___2.company_id)) OR policy_superadmin() OR (__local_67___2.id = current_user_id())))
220. 0.001 0.006 ↓ 0.0 0 1

Nested Loop (cost=0.56..25.37 rows=1 width=16) (actual time=0.006..0.006 rows=0 loops=1)

  • Output: __local_68___2.user_id
  • Inner Unique: true
221. 0.005 0.005 ↓ 0.0 0 1

Index Scan using user_department_group_user_id_index on public.user_department_group __local_68___2 (cost=0.28..8.55 rows=1 width=32) (actual time=0.005..0.005 rows=0 loops=1)

  • Output: __local_68___2.group_id, __local_68___2.user_id
  • Index Cond: (__local_68___2.user_id = __local_1___2.user_id)
  • Filter: (__local_68___2.company_id = current_user_company())
222. 0.000 0.000 ↓ 0.0 0

Index Scan using group_pkey on public."group" __local_69___2 (cost=0.28..8.55 rows=1 width=16) (never executed)

  • Output: __local_69___2.id
  • Index Cond: (__local_69___2.id = __local_68___2.group_id)
  • Filter: ((__local_69___2.company_id = current_user_company()) AND ((__local_69___2.description)::text ~~* '%Anne1 Niels%'::text))
223. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=77.75..86.13 rows=1 width=16) (never executed)

  • Output: __local_67___3.id
  • Inner Unique: true
224. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=77.47..77.48 rows=1 width=16) (never executed)

  • Output: __local_68___3.user_id
  • Group Key: __local_68___3.user_id
225. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=18.52..77.46 rows=1 width=16) (never executed)

  • Output: __local_68___3.user_id
226. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public."group" __local_69___3 (cost=9.12..63.79 rows=1 width=16) (never executed)

  • Output: __local_69___3.id
  • Recheck Cond: (__local_69___3.company_id = current_user_company())
  • Filter: ((__local_69___3.description)::text ~~* '%Anne1 Niels%'::text)
227. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on public_group_company_name_scope_idx (cost=0.00..9.12 rows=78 width=0) (never executed)

  • Index Cond: (__local_69___3.company_id = current_user_company())
228. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public.user_department_group __local_68___3 (cost=9.40..13.67 rows=1 width=32) (never executed)

  • Output: __local_68___3.group_id, __local_68___3.user_id
  • Recheck Cond: ((__local_68___3.group_id = __local_69___3.id) AND (__local_68___3.company_id = current_user_company()))
229. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=9.40..9.40 rows=1 width=0) (never executed)

230. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on user_department_group_group_id_index (cost=0.00..4.33 rows=7 width=0) (never executed)

  • Index Cond: (__local_68___3.group_id = __local_69___3.id)
231. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on user_department_group_company_id_index (cost=0.00..4.81 rows=38 width=0) (never executed)

  • Index Cond: (__local_68___3.company_id = current_user_company())
232. 0.000 0.000 ↓ 0.0 0

Index Scan using user_pkey on public."user" __local_67___3 (cost=0.28..8.65 rows=1 width=16) (never executed)

  • Output: __local_67___3.id
  • Index Cond: (__local_67___3.id = __local_68___3.user_id)
  • Filter: ((policy_superadmin() OR (__local_67___3.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_67___3.id, __local_67___3.departments, __local_67___3.company_id) OR (__local_67___3.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_67___3.id, __local_67___3.departments, __local_67___3.company_id)) OR policy_superadmin() OR (__local_67___3.id = current_user_id())))
233. 0.002 0.271 ↓ 0.0 0 1

Nested Loop Semi Join (cost=0.84..35.19 rows=1 width=0) (actual time=0.271..0.271 rows=0 loops=1)

234. 0.261 0.261 ↑ 1.0 1 1

Index Scan using vw_user_id_company_idx on public."user" __local_70___2 (cost=0.28..9.81 rows=1 width=16) (actual time=0.261..0.261 rows=1 loops=1)

  • Output: __local_70___2.id
  • Index Cond: (__local_70___2.id = __local_1___2.user_id)
  • Filter: ((policy_superadmin() OR (__local_70___2.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_70___2.id, __local_70___2.departments, __local_70___2.company_id) OR (__local_70___2.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_70___2.id, __local_70___2.departments, __local_70___2.company_id)) OR policy_superadmin() OR (__local_70___2.id = current_user_id())))
235. 0.001 0.008 ↓ 0.0 0 1

Nested Loop (cost=0.56..25.37 rows=1 width=16) (actual time=0.008..0.008 rows=0 loops=1)

  • Output: __local_71___2.user_id
  • Inner Unique: true
236. 0.007 0.007 ↓ 0.0 0 1

Index Scan using user_company_group_user_id_index on public.user_company_group __local_71___2 (cost=0.28..8.55 rows=1 width=32) (actual time=0.007..0.007 rows=0 loops=1)

  • Output: __local_71___2.user_id, __local_71___2.group_id, __local_71___2.company_id
  • Index Cond: (__local_71___2.user_id = __local_1___2.user_id)
  • Filter: (__local_71___2.company_id = current_user_company())
237. 0.000 0.000 ↓ 0.0 0

Index Scan using group_pkey on public."group" __local_72___2 (cost=0.28..8.55 rows=1 width=16) (never executed)

  • Output: __local_72___2.id
  • Index Cond: (__local_72___2.id = __local_71___2.group_id)
  • Filter: ((__local_72___2.company_id = current_user_company()) AND ((__local_72___2.description)::text ~~* '%Anne1 Niels%'::text))
238. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=77.69..86.40 rows=1 width=16) (never executed)

  • Output: __local_70___3.id
  • Inner Unique: true
239. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=77.40..77.41 rows=1 width=16) (never executed)

  • Output: __local_71___3.user_id
  • Group Key: __local_71___3.user_id
240. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=18.46..77.40 rows=1 width=16) (never executed)

  • Output: __local_71___3.user_id
241. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public."group" __local_72___3 (cost=9.12..63.79 rows=1 width=16) (never executed)

  • Output: __local_72___3.id
  • Recheck Cond: (__local_72___3.company_id = current_user_company())
  • Filter: ((__local_72___3.description)::text ~~* '%Anne1 Niels%'::text)
242. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on public_group_company_name_scope_idx (cost=0.00..9.12 rows=78 width=0) (never executed)

  • Index Cond: (__local_72___3.company_id = current_user_company())
243. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public.user_company_group __local_71___3 (cost=9.34..13.61 rows=1 width=32) (never executed)

  • Output: __local_71___3.user_id, __local_71___3.group_id, __local_71___3.company_id
  • Recheck Cond: ((__local_71___3.group_id = __local_72___3.id) AND (__local_71___3.company_id = current_user_company()))
244. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=9.34..9.34 rows=1 width=0) (never executed)

245. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on user_company_group_group_id_index (cost=0.00..4.34 rows=8 width=0) (never executed)

  • Index Cond: (__local_71___3.group_id = __local_72___3.id)
246. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on user_company_group_company_id_index (cost=0.00..4.75 rows=29 width=0) (never executed)

  • Index Cond: (__local_71___3.company_id = current_user_company())
247. 0.000 0.000 ↓ 0.0 0

Index Scan using user_pkey on public."user" __local_70___3 (cost=0.28..8.98 rows=1 width=16) (never executed)

  • Output: __local_70___3.id
  • Index Cond: (__local_70___3.id = __local_71___3.user_id)
  • Filter: ((policy_superadmin() OR (__local_70___3.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_70___3.id, __local_70___3.departments, __local_70___3.company_id) OR (__local_70___3.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_70___3.id, __local_70___3.departments, __local_70___3.company_id)) OR policy_superadmin() OR (__local_70___3.id = current_user_id())))
248. 0.255 0.255 ↑ 1.0 1 1

Index Scan using vw_user_id_company_idx on public."user" __local_52___1 (cost=0.28..9.81 rows=1 width=16) (actual time=0.255..0.255 rows=1 loops=1)

  • Output: __local_52___1.id
  • Index Cond: (__local_52___1.id = __local_1___2.user_id)
  • Filter: (__local_52___1.active AND (policy_superadmin() OR (__local_52___1.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_52___1.id, __local_52___1.departments, __local_52___1.company_id) OR (__local_52___1.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_52___1.id, __local_52___1.departments, __local_52___1.company_id)) OR policy_superadmin() OR (__local_52___1.id = current_user_id())))
249. 0.009 57.055 ↑ 1.0 1 1

Aggregate (cost=216,475.08..216,475.10 rows=1 width=32) (actual time=57.055..57.055 rows=1 loops=1)

  • Output: json_build_object('totalCount'::text, count(1))
250. 0.004 57.046 ↑ 1.0 1 1

Nested Loop (cost=0.53..216,475.08 rows=1 width=0) (actual time=49.009..57.046 rows=1 loops=1)

  • Inner Unique: true
251. 45.358 56.293 ↑ 1.0 1 1

Function Scan on public.employees_search __local_1___3 (cost=0.25..216,465.25 rows=1 width=16) (actual time=48.257..56.293 rows=1 loops=1)

  • Output: __local_1___3.user_id
  • Function Call: employees_search('Anne1 Niels'::text)
  • Filter: (__local_1___3.active AND ((__local_1___3.employment_end IS NULL) OR (__local_1___3.employment_end > '2020-02-05'::date)) AND (__local_1___3.company_id = '47d08a0b-2c1b-4591-acc0-4d521915c8ef'::uuid) AND (((__local_1___3.employment_end IS NULL) AND ((employee_job_position_title(__local_1___3.*))::text ~~* '%Anne1 Niels%'::text)) OR ((__local_1___3.employment_end > '2020-02-05'::date) AND (employee_job_position_description(__local_1___3.*) ~~* '%Anne1 Niels%'::text)) OR (alternatives: SubPlan 114 or hashed SubPlan 115) OR (alternatives: SubPlan 116 or hashed SubPlan 117) OR (alternatives: SubPlan 118 or hashed SubPlan 119) OR (alternatives: SubPlan 120 or hashed SubPlan 121) OR (alternatives: SubPlan 122 or hashed SubPlan 123) OR (alternatives: SubPlan 124 or hashed SubPlan 125) OR (alternatives: SubPlan 126 or hashed SubPlan 127) OR (alternatives: SubPlan 128 or hashed SubPlan 129) OR (alternatives: SubPlan 130 or hashed SubPlan 131) OR (alternatives: SubPlan 132 or hashed SubPlan 133) OR (alternatives: SubPlan 134 or hashed SubPlan 135) OR (alternatives: SubPlan 136 or hashed SubPlan 137) OR (alternatives: SubPlan 138 or hashed SubPlan 139) OR (alternatives: SubPlan 140 or hashed SubPlan 141)))
  • Rows Removed by Filter: 1
252.          

SubPlan (for Function Scan)

253. 1.402 1.402 ↓ 0.0 0 2

Index Scan using vw_user_id_company_idx on public."user" __local_53___4 (cost=0.28..10.06 rows=1 width=0) (actual time=0.701..0.701 rows=0 loops=2)

  • Index Cond: (__local_1___3.user_id = __local_53___4.id)
  • Filter: ((policy_superadmin() OR (__local_53___4.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_53___4.id, __local_53___4.departments, __local_53___4.company_id) OR (__local_53___4.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_53___4.id, __local_53___4.departments, __local_53___4.company_id)) OR policy_superadmin() OR (__local_53___4.id = current_user_id())) AND ((user_first_name(__local_53___4.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
254. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_53___5 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_53___5.id
  • Filter: ((policy_superadmin() OR (__local_53___5.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_53___5.id, __local_53___5.departments, __local_53___5.company_id) OR (__local_53___5.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_53___5.id, __local_53___5.departments, __local_53___5.company_id)) OR policy_superadmin() OR (__local_53___5.id = current_user_id())) AND ((user_first_name(__local_53___5.*))::text ~~* '%Anne1 Niels%'::text))
255. 0.834 0.834 ↓ 0.0 0 2

Index Scan using vw_user_id_company_idx on public."user" __local_54___4 (cost=0.28..10.06 rows=1 width=0) (actual time=0.417..0.417 rows=0 loops=2)

  • Index Cond: (__local_1___3.user_id = __local_54___4.id)
  • Filter: ((policy_superadmin() OR (__local_54___4.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_54___4.id, __local_54___4.departments, __local_54___4.company_id) OR (__local_54___4.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_54___4.id, __local_54___4.departments, __local_54___4.company_id)) OR policy_superadmin() OR (__local_54___4.id = current_user_id())) AND ((user_last_name(__local_54___4.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
256. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_54___5 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_54___5.id
  • Filter: ((policy_superadmin() OR (__local_54___5.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_54___5.id, __local_54___5.departments, __local_54___5.company_id) OR (__local_54___5.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_54___5.id, __local_54___5.departments, __local_54___5.company_id)) OR policy_superadmin() OR (__local_54___5.id = current_user_id())) AND ((user_last_name(__local_54___5.*))::text ~~* '%Anne1 Niels%'::text))
257. 2.398 2.398 ↓ 0.0 0 2

Index Scan using vw_user_id_company_idx on public."user" __local_55___4 (cost=0.28..10.06 rows=1 width=0) (actual time=1.199..1.199 rows=0 loops=2)

  • Index Cond: (__local_1___3.user_id = __local_55___4.id)
  • Filter: ((policy_superadmin() OR (__local_55___4.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_55___4.id, __local_55___4.departments, __local_55___4.company_id) OR (__local_55___4.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_55___4.id, __local_55___4.departments, __local_55___4.company_id)) OR policy_superadmin() OR (__local_55___4.id = current_user_id())) AND ((user_full_name(__local_55___4.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 0
258. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_55___5 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_55___5.id
  • Filter: ((policy_superadmin() OR (__local_55___5.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_55___5.id, __local_55___5.departments, __local_55___5.company_id) OR (__local_55___5.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_55___5.id, __local_55___5.departments, __local_55___5.company_id)) OR policy_superadmin() OR (__local_55___5.id = current_user_id())) AND ((user_full_name(__local_55___5.*))::text ~~* '%Anne1 Niels%'::text))
259. 0.571 0.571 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_56___4 (cost=0.28..10.06 rows=1 width=0) (actual time=0.571..0.571 rows=0 loops=1)

  • Index Cond: (__local_1___3.user_id = __local_56___4.id)
  • Filter: ((policy_superadmin() OR (__local_56___4.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_56___4.id, __local_56___4.departments, __local_56___4.company_id) OR (__local_56___4.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_56___4.id, __local_56___4.departments, __local_56___4.company_id)) OR policy_superadmin() OR (__local_56___4.id = current_user_id())) AND ((user_email(__local_56___4.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
260. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_56___5 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_56___5.id
  • Filter: ((policy_superadmin() OR (__local_56___5.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_56___5.id, __local_56___5.departments, __local_56___5.company_id) OR (__local_56___5.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_56___5.id, __local_56___5.departments, __local_56___5.company_id)) OR policy_superadmin() OR (__local_56___5.id = current_user_id())) AND ((user_email(__local_56___5.*))::text ~~* '%Anne1 Niels%'::text))
261. 0.844 0.844 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_57___4 (cost=0.28..10.06 rows=1 width=0) (actual time=0.844..0.844 rows=0 loops=1)

  • Index Cond: (__local_1___3.user_id = __local_57___4.id)
  • Filter: ((policy_superadmin() OR (__local_57___4.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_57___4.id, __local_57___4.departments, __local_57___4.company_id) OR (__local_57___4.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_57___4.id, __local_57___4.departments, __local_57___4.company_id)) OR policy_superadmin() OR (__local_57___4.id = current_user_id())) AND ((user_email_work(__local_57___4.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
262. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_57___5 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_57___5.id
  • Filter: ((policy_superadmin() OR (__local_57___5.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_57___5.id, __local_57___5.departments, __local_57___5.company_id) OR (__local_57___5.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_57___5.id, __local_57___5.departments, __local_57___5.company_id)) OR policy_superadmin() OR (__local_57___5.id = current_user_id())) AND ((user_email_work(__local_57___5.*))::text ~~* '%Anne1 Niels%'::text))
263. 0.602 0.602 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_58___4 (cost=0.28..10.06 rows=1 width=0) (actual time=0.602..0.602 rows=0 loops=1)

  • Index Cond: (__local_1___3.user_id = __local_58___4.id)
  • Filter: ((policy_superadmin() OR (__local_58___4.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_58___4.id, __local_58___4.departments, __local_58___4.company_id) OR (__local_58___4.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_58___4.id, __local_58___4.departments, __local_58___4.company_id)) OR policy_superadmin() OR (__local_58___4.id = current_user_id())) AND ((user_phone(__local_58___4.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
264. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_58___5 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_58___5.id
  • Filter: ((policy_superadmin() OR (__local_58___5.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_58___5.id, __local_58___5.departments, __local_58___5.company_id) OR (__local_58___5.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_58___5.id, __local_58___5.departments, __local_58___5.company_id)) OR policy_superadmin() OR (__local_58___5.id = current_user_id())) AND ((user_phone(__local_58___5.*))::text ~~* '%Anne1 Niels%'::text))
265. 0.663 0.663 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_59___4 (cost=0.28..10.06 rows=1 width=0) (actual time=0.663..0.663 rows=0 loops=1)

  • Index Cond: (__local_1___3.user_id = __local_59___4.id)
  • Filter: ((policy_superadmin() OR (__local_59___4.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_59___4.id, __local_59___4.departments, __local_59___4.company_id) OR (__local_59___4.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_59___4.id, __local_59___4.departments, __local_59___4.company_id)) OR policy_superadmin() OR (__local_59___4.id = current_user_id())) AND ((user_mobile(__local_59___4.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
266. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_59___5 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_59___5.id
  • Filter: ((policy_superadmin() OR (__local_59___5.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_59___5.id, __local_59___5.departments, __local_59___5.company_id) OR (__local_59___5.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_59___5.id, __local_59___5.departments, __local_59___5.company_id)) OR policy_superadmin() OR (__local_59___5.id = current_user_id())) AND ((user_mobile(__local_59___5.*))::text ~~* '%Anne1 Niels%'::text))
267. 0.794 0.794 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_60___4 (cost=0.28..10.06 rows=1 width=0) (actual time=0.794..0.794 rows=0 loops=1)

  • Index Cond: (__local_1___3.user_id = __local_60___4.id)
  • Filter: ((policy_superadmin() OR (__local_60___4.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_60___4.id, __local_60___4.departments, __local_60___4.company_id) OR (__local_60___4.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_60___4.id, __local_60___4.departments, __local_60___4.company_id)) OR policy_superadmin() OR (__local_60___4.id = current_user_id())) AND ((user_address(__local_60___4.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
268. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_60___5 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_60___5.id
  • Filter: ((policy_superadmin() OR (__local_60___5.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_60___5.id, __local_60___5.departments, __local_60___5.company_id) OR (__local_60___5.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_60___5.id, __local_60___5.departments, __local_60___5.company_id)) OR policy_superadmin() OR (__local_60___5.id = current_user_id())) AND ((user_address(__local_60___5.*))::text ~~* '%Anne1 Niels%'::text))
269. 0.565 0.565 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_61___4 (cost=0.28..10.06 rows=1 width=0) (actual time=0.565..0.565 rows=0 loops=1)

  • Index Cond: (__local_1___3.user_id = __local_61___4.id)
  • Filter: ((policy_superadmin() OR (__local_61___4.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_61___4.id, __local_61___4.departments, __local_61___4.company_id) OR (__local_61___4.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_61___4.id, __local_61___4.departments, __local_61___4.company_id)) OR policy_superadmin() OR (__local_61___4.id = current_user_id())) AND ((user_city(__local_61___4.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
270. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_61___5 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_61___5.id
  • Filter: ((policy_superadmin() OR (__local_61___5.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_61___5.id, __local_61___5.departments, __local_61___5.company_id) OR (__local_61___5.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_61___5.id, __local_61___5.departments, __local_61___5.company_id)) OR policy_superadmin() OR (__local_61___5.id = current_user_id())) AND ((user_city(__local_61___5.*))::text ~~* '%Anne1 Niels%'::text))
271. 0.691 0.691 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_62___4 (cost=0.28..10.06 rows=1 width=0) (actual time=0.691..0.691 rows=0 loops=1)

  • Index Cond: (__local_1___3.user_id = __local_62___4.id)
  • Filter: ((policy_superadmin() OR (__local_62___4.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_62___4.id, __local_62___4.departments, __local_62___4.company_id) OR (__local_62___4.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_62___4.id, __local_62___4.departments, __local_62___4.company_id)) OR policy_superadmin() OR (__local_62___4.id = current_user_id())) AND ((user_postal_code(__local_62___4.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
272. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_62___5 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_62___5.id
  • Filter: ((policy_superadmin() OR (__local_62___5.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_62___5.id, __local_62___5.departments, __local_62___5.company_id) OR (__local_62___5.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_62___5.id, __local_62___5.departments, __local_62___5.company_id)) OR policy_superadmin() OR (__local_62___5.id = current_user_id())) AND ((user_postal_code(__local_62___5.*))::text ~~* '%Anne1 Niels%'::text))
273. 0.569 0.569 ↓ 0.0 0 1

Index Scan using vw_user_id_company_idx on public."user" __local_63___4 (cost=0.28..10.06 rows=1 width=0) (actual time=0.569..0.569 rows=0 loops=1)

  • Index Cond: (__local_1___3.user_id = __local_63___4.id)
  • Filter: ((policy_superadmin() OR (__local_63___4.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_63___4.id, __local_63___4.departments, __local_63___4.company_id) OR (__local_63___4.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_63___4.id, __local_63___4.departments, __local_63___4.company_id)) OR policy_superadmin() OR (__local_63___4.id = current_user_id())) AND ((user_country(__local_63___4.*))::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
274. 0.000 0.000 ↓ 0.0 0

Seq Scan on public."user" __local_63___5 (cost=0.00..12,978.64 rows=1 width=16) (never executed)

  • Output: __local_63___5.id
  • Filter: ((policy_superadmin() OR (__local_63___5.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_63___5.id, __local_63___5.departments, __local_63___5.company_id) OR (__local_63___5.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_63___5.id, __local_63___5.departments, __local_63___5.company_id)) OR policy_superadmin() OR (__local_63___5.id = current_user_id())) AND ((user_country(__local_63___5.*))::text ~~* '%Anne1 Niels%'::text))
275. 0.003 0.343 ↓ 0.0 0 1

Nested Loop Semi Join (cost=0.84..34.94 rows=1 width=0) (actual time=0.343..0.343 rows=0 loops=1)

276. 0.277 0.277 ↑ 1.0 1 1

Index Scan using vw_user_id_company_idx on public."user" __local_64___4 (cost=0.28..9.81 rows=1 width=16) (actual time=0.277..0.277 rows=1 loops=1)

  • Output: __local_64___4.id
  • Index Cond: (__local_64___4.id = __local_1___3.user_id)
  • Filter: ((policy_superadmin() OR (__local_64___4.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_64___4.id, __local_64___4.departments, __local_64___4.company_id) OR (__local_64___4.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_64___4.id, __local_64___4.departments, __local_64___4.company_id)) OR policy_superadmin() OR (__local_64___4.id = current_user_id())))
277. 0.003 0.063 ↓ 0.0 0 1

Nested Loop (cost=0.56..25.12 rows=1 width=16) (actual time=0.063..0.063 rows=0 loops=1)

  • Output: __local_65___4.user_id
  • Inner Unique: true
278. 0.010 0.010 ↓ 2.0 2 1

Index Only Scan using user_group_pkey on public.user_group __local_65___4 (cost=0.28..8.29 rows=1 width=32) (actual time=0.008..0.010 rows=2 loops=1)

  • Output: __local_65___4.user_id, __local_65___4.group_id
  • Index Cond: (__local_65___4.user_id = __local_1___3.user_id)
  • Heap Fetches: 2
279. 0.050 0.050 ↓ 0.0 0 2

Index Scan using group_pkey on public."group" __local_66___4 (cost=0.28..8.55 rows=1 width=16) (actual time=0.025..0.025 rows=0 loops=2)

  • Output: __local_66___4.id
  • Index Cond: (__local_66___4.id = __local_65___4.group_id)
  • Filter: ((__local_66___4.company_id = current_user_company()) AND ((__local_66___4.description)::text ~~* '%Anne1 Niels%'::text))
  • Rows Removed by Filter: 1
280. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=96.91..100.07 rows=1 width=16) (never executed)

  • Output: __local_64___5.id
  • Inner Unique: true
281. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=96.63..96.64 rows=1 width=16) (never executed)

  • Output: __local_65___5.user_id
  • Group Key: __local_65___5.user_id
282. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=63.80..96.62 rows=1 width=16) (never executed)

  • Output: __local_65___5.user_id
  • Inner Unique: true
  • Hash Cond: (__local_65___5.group_id = __local_66___5.id)
283. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.user_group __local_65___5 (cost=0.00..29.11 rows=1,411 width=32) (never executed)

  • Output: __local_65___5.user_id, __local_65___5.group_id, __local_65___5.company_id
284. 0.000 0.000 ↓ 0.0 0

Hash (cost=63.79..63.79 rows=1 width=16) (never executed)

  • Output: __local_66___5.id
285. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public."group" __local_66___5 (cost=9.12..63.79 rows=1 width=16) (never executed)

  • Output: __local_66___5.id
  • Recheck Cond: (__local_66___5.company_id = current_user_company())
  • Filter: ((__local_66___5.description)::text ~~* '%Anne1 Niels%'::text)
286. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on public_group_company_name_scope_idx (cost=0.00..9.12 rows=78 width=0) (never executed)

  • Index Cond: (__local_66___5.company_id = current_user_company())
287. 0.000 0.000 ↓ 0.0 0

Index Scan using user_pkey on public."user" __local_64___5 (cost=0.28..3.43 rows=1 width=16) (never executed)

  • Output: __local_64___5.id
  • Index Cond: (__local_64___5.id = __local_65___5.user_id)
  • Filter: ((policy_superadmin() OR (__local_64___5.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_64___5.id, __local_64___5.departments, __local_64___5.company_id) OR (__local_64___5.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_64___5.id, __local_64___5.departments, __local_64___5.company_id)) OR policy_superadmin() OR (__local_64___5.id = current_user_id())))
288. 0.003 0.305 ↓ 0.0 0 1

Nested Loop Semi Join (cost=0.84..35.19 rows=1 width=0) (actual time=0.305..0.305 rows=0 loops=1)

289. 0.297 0.297 ↑ 1.0 1 1

Index Scan using vw_user_id_company_idx on public."user" __local_67___4 (cost=0.28..9.81 rows=1 width=16) (actual time=0.297..0.297 rows=1 loops=1)

  • Output: __local_67___4.id
  • Index Cond: (__local_67___4.id = __local_1___3.user_id)
  • Filter: ((policy_superadmin() OR (__local_67___4.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_67___4.id, __local_67___4.departments, __local_67___4.company_id) OR (__local_67___4.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_67___4.id, __local_67___4.departments, __local_67___4.company_id)) OR policy_superadmin() OR (__local_67___4.id = current_user_id())))
290. 0.001 0.005 ↓ 0.0 0 1

Nested Loop (cost=0.56..25.37 rows=1 width=16) (actual time=0.005..0.005 rows=0 loops=1)

  • Output: __local_68___4.user_id
  • Inner Unique: true
291. 0.004 0.004 ↓ 0.0 0 1

Index Scan using user_department_group_user_id_index on public.user_department_group __local_68___4 (cost=0.28..8.55 rows=1 width=32) (actual time=0.004..0.004 rows=0 loops=1)

  • Output: __local_68___4.group_id, __local_68___4.user_id
  • Index Cond: (__local_68___4.user_id = __local_1___3.user_id)
  • Filter: (__local_68___4.company_id = current_user_company())
292. 0.000 0.000 ↓ 0.0 0

Index Scan using group_pkey on public."group" __local_69___4 (cost=0.28..8.55 rows=1 width=16) (never executed)

  • Output: __local_69___4.id
  • Index Cond: (__local_69___4.id = __local_68___4.group_id)
  • Filter: ((__local_69___4.company_id = current_user_company()) AND ((__local_69___4.description)::text ~~* '%Anne1 Niels%'::text))
293. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=77.75..86.13 rows=1 width=16) (never executed)

  • Output: __local_67___5.id
  • Inner Unique: true
294. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=77.47..77.48 rows=1 width=16) (never executed)

  • Output: __local_68___5.user_id
  • Group Key: __local_68___5.user_id
295. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=18.52..77.46 rows=1 width=16) (never executed)

  • Output: __local_68___5.user_id
296. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public."group" __local_69___5 (cost=9.12..63.79 rows=1 width=16) (never executed)

  • Output: __local_69___5.id
  • Recheck Cond: (__local_69___5.company_id = current_user_company())
  • Filter: ((__local_69___5.description)::text ~~* '%Anne1 Niels%'::text)
297. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on public_group_company_name_scope_idx (cost=0.00..9.12 rows=78 width=0) (never executed)

  • Index Cond: (__local_69___5.company_id = current_user_company())
298. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public.user_department_group __local_68___5 (cost=9.40..13.67 rows=1 width=32) (never executed)

  • Output: __local_68___5.group_id, __local_68___5.user_id
  • Recheck Cond: ((__local_68___5.group_id = __local_69___5.id) AND (__local_68___5.company_id = current_user_company()))
299. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=9.40..9.40 rows=1 width=0) (never executed)

300. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on user_department_group_group_id_index (cost=0.00..4.33 rows=7 width=0) (never executed)

  • Index Cond: (__local_68___5.group_id = __local_69___5.id)
301. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on user_department_group_company_id_index (cost=0.00..4.81 rows=38 width=0) (never executed)

  • Index Cond: (__local_68___5.company_id = current_user_company())
302. 0.000 0.000 ↓ 0.0 0

Index Scan using user_pkey on public."user" __local_67___5 (cost=0.28..8.65 rows=1 width=16) (never executed)

  • Output: __local_67___5.id
  • Index Cond: (__local_67___5.id = __local_68___5.user_id)
  • Filter: ((policy_superadmin() OR (__local_67___5.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_67___5.id, __local_67___5.departments, __local_67___5.company_id) OR (__local_67___5.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_67___5.id, __local_67___5.departments, __local_67___5.company_id)) OR policy_superadmin() OR (__local_67___5.id = current_user_id())))
303. 0.002 0.354 ↓ 0.0 0 1

Nested Loop Semi Join (cost=0.84..35.19 rows=1 width=0) (actual time=0.354..0.354 rows=0 loops=1)

304. 0.345 0.345 ↑ 1.0 1 1

Index Scan using vw_user_id_company_idx on public."user" __local_70___4 (cost=0.28..9.81 rows=1 width=16) (actual time=0.345..0.345 rows=1 loops=1)

  • Output: __local_70___4.id
  • Index Cond: (__local_70___4.id = __local_1___3.user_id)
  • Filter: ((policy_superadmin() OR (__local_70___4.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_70___4.id, __local_70___4.departments, __local_70___4.company_id) OR (__local_70___4.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_70___4.id, __local_70___4.departments, __local_70___4.company_id)) OR policy_superadmin() OR (__local_70___4.id = current_user_id())))
305. 0.001 0.007 ↓ 0.0 0 1

Nested Loop (cost=0.56..25.37 rows=1 width=16) (actual time=0.007..0.007 rows=0 loops=1)

  • Output: __local_71___4.user_id
  • Inner Unique: true
306. 0.006 0.006 ↓ 0.0 0 1

Index Scan using user_company_group_user_id_index on public.user_company_group __local_71___4 (cost=0.28..8.55 rows=1 width=32) (actual time=0.006..0.006 rows=0 loops=1)

  • Output: __local_71___4.user_id, __local_71___4.group_id, __local_71___4.company_id
  • Index Cond: (__local_71___4.user_id = __local_1___3.user_id)
  • Filter: (__local_71___4.company_id = current_user_company())
307. 0.000 0.000 ↓ 0.0 0

Index Scan using group_pkey on public."group" __local_72___4 (cost=0.28..8.55 rows=1 width=16) (never executed)

  • Output: __local_72___4.id
  • Index Cond: (__local_72___4.id = __local_71___4.group_id)
  • Filter: ((__local_72___4.company_id = current_user_company()) AND ((__local_72___4.description)::text ~~* '%Anne1 Niels%'::text))
308. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=77.69..86.40 rows=1 width=16) (never executed)

  • Output: __local_70___5.id
  • Inner Unique: true
309. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=77.40..77.41 rows=1 width=16) (never executed)

  • Output: __local_71___5.user_id
  • Group Key: __local_71___5.user_id
310. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=18.46..77.40 rows=1 width=16) (never executed)

  • Output: __local_71___5.user_id
311. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public."group" __local_72___5 (cost=9.12..63.79 rows=1 width=16) (never executed)

  • Output: __local_72___5.id
  • Recheck Cond: (__local_72___5.company_id = current_user_company())
  • Filter: ((__local_72___5.description)::text ~~* '%Anne1 Niels%'::text)
312. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on public_group_company_name_scope_idx (cost=0.00..9.12 rows=78 width=0) (never executed)

  • Index Cond: (__local_72___5.company_id = current_user_company())
313. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public.user_company_group __local_71___5 (cost=9.34..13.61 rows=1 width=32) (never executed)

  • Output: __local_71___5.user_id, __local_71___5.group_id, __local_71___5.company_id
  • Recheck Cond: ((__local_71___5.group_id = __local_72___5.id) AND (__local_71___5.company_id = current_user_company()))
314. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=9.34..9.34 rows=1 width=0) (never executed)

315. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on user_company_group_group_id_index (cost=0.00..4.34 rows=8 width=0) (never executed)

  • Index Cond: (__local_71___5.group_id = __local_72___5.id)
316. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on user_company_group_company_id_index (cost=0.00..4.75 rows=29 width=0) (never executed)

  • Index Cond: (__local_71___5.company_id = current_user_company())
317. 0.000 0.000 ↓ 0.0 0

Index Scan using user_pkey on public."user" __local_70___5 (cost=0.28..8.98 rows=1 width=16) (never executed)

  • Output: __local_70___5.id
  • Index Cond: (__local_70___5.id = __local_71___5.user_id)
  • Filter: ((policy_superadmin() OR (__local_70___5.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_70___5.id, __local_70___5.departments, __local_70___5.company_id) OR (__local_70___5.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_70___5.id, __local_70___5.departments, __local_70___5.company_id)) OR policy_superadmin() OR (__local_70___5.id = current_user_id())))
318. 0.749 0.749 ↑ 1.0 1 1

Index Scan using vw_user_id_company_idx on public."user" __local_52___2 (cost=0.28..9.81 rows=1 width=16) (actual time=0.749..0.749 rows=1 loops=1)

  • Output: __local_52___2.id
  • Index Cond: (__local_52___2.id = __local_1___3.user_id)
  • Filter: (__local_52___2.active AND (policy_superadmin() OR (__local_52___2.company_id = current_company_id())) AND (policy_role_check('employee'::text, 'general'::text, 'read'::text, __local_52___2.id, __local_52___2.departments, __local_52___2.company_id) OR (__local_52___2.is_leader AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, __local_52___2.id, __local_52___2.departments, __local_52___2.company_id)) OR policy_superadmin() OR (__local_52___2.id = current_user_id())))