explain.depesz.com

PostgreSQL's explain analyze made readable

Result: o2Ft

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Unique (cost=18,631,381,569.14..18,635,707,940.14 rows=865,274,200 width=563) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Sort (cost=18,631,381,569.14..18,633,544,754.64 rows=865,274,200 width=563) (actual rows= loops=)

  • Sort Key: p.person_uuid, p.first_name, p.last_name
3. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=17,877,439,139.82..17,940,171,519.32 rows=865,274,200 width=563) (actual rows= loops=)

  • Group Key: p.revision_uuid, pr.valid_range, pr.sequence
4. 0.000 0.000 ↓ 0.0

Sort (cost=17,877,439,139.82..17,879,602,325.32 rows=865,274,200 width=572) (actual rows= loops=)

  • Sort Key: p.revision_uuid, pr.valid_range, pr.sequence
5. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=2.52..17,178,624,134.99 rows=865,274,200 width=572) (actual rows= loops=)

  • Join Filter: (role.role_uuid = (((jsonb_array_elements_text(pr.roles)))::uuid))
6. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.56..17,087,770,310.27 rows=865,274,200 width=531) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.56..17,050,844,733.79 rows=8,652,742 width=548) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Seq Scan on persons p (cost=0.00..17,044,847,004.30 rows=8,652,742 width=487) (actual rows= loops=)

  • Filter: (((organization_uuid = '02ea59bf-4c3c-42e1-8f47-1d037f8755b9'::uuid) AND (valid_range @> '2019-08-08 15:57:26-07'::timestamp with time zone) AND (is_visible IS TRUE) AND (((first_name)::text ~~* '%hpomi%'::text) OR ((last_name)::text ~~* '%hpomi%'::text) OR ((target_name)::text ~~* '%hpomi%'::text) OR ((web_login)::text ~~ '%hpomi%'::text))) OR ((((first_name)::text ~~* '%w%'::text) OR ((last_name)::text ~~* '%w%'::text) OR ((target_name)::text ~~* '%w%'::text) OR ((web_login)::text ~~ '%w%'::text)) AND ((person_uuid = '4b6fe547-24da-c5eb-cdea-1fa664f8053e'::uuid) OR (SubPlan 1) OR (SubPlan 2)) AND (NOT (alternatives: SubPlan 3 or hashed SubPlan 4))))
9.          

SubPlan (for Seq Scan)

10. 0.000 0.000 ↓ 0.0

Result (cost=0.56..3.58 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: upper_inf(p.valid_range)
11. 0.000 0.000 ↓ 0.0

Index Scan using person_roles_org_seq_vrange_uidx on person_roles (cost=0.56..3.58 rows=1 width=0) (actual rows= loops=)

  • Index Cond: ((organization_uuid = '02ea59bf-4c3c-42e1-8f47-1d037f8755b9'::uuid) AND (person_uuid = '4b6fe547-24da-c5eb-cdea-1fa664f8053e'::uuid))
  • Filter: (is_company_admin AND upper_inf(valid_range))
12. 0.000 0.000 ↓ 0.0

Nested Loop (cost=6.07..204.02 rows=1 width=0) (actual rows= loops=)

  • Join Filter: (rr.target_role_uuid = (((jsonb_array_elements_text(tpr.roles)))::uuid))
13. 0.000 0.000 ↓ 0.0

Nested Loop (cost=6.07..199.51 rows=1 width=49) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Nested Loop (cost=5.50..195.91 rows=1 width=16) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Index Scan using person_roles_org_seq_vrange_uidx on person_roles spr (cost=0.56..3.58 rows=1 width=33) (actual rows= loops=)

  • Index Cond: ((organization_uuid = '02ea59bf-4c3c-42e1-8f47-1d037f8755b9'::uuid) AND (person_uuid = '4b6fe547-24da-c5eb-cdea-1fa664f8053e'::uuid))
  • Filter: upper_inf(valid_range)
16. 0.000 0.000 ↓ 0.0

Hash Join (cost=4.94..192.32 rows=1 width=16) (actual rows= loops=)

  • Hash Cond: (rr.source_role_uuid = (((jsonb_array_elements_text(spr.roles)))::uuid))
17. 0.000 0.000 ↓ 0.0

Index Scan using role_on_role_organization_uuid_idx on role_on_role rr (cost=0.42..187.61 rows=47 width=32) (actual rows= loops=)

  • Index Cond: (organization_uuid = '02ea59bf-4c3c-42e1-8f47-1d037f8755b9'::uuid)
  • Filter: ((can_edit_person OR can_view_person OR can_use_person) AND upper_inf(valid_range))
18. 0.000 0.000 ↓ 0.0

Hash (cost=3.27..3.27 rows=100 width=16) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Result (cost=0.00..2.27 rows=100 width=16) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

ProjectSet (cost=0.00..0.52 rows=100 width=32) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Result (cost=0.00..0.01 rows=1 width=0) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Index Scan using person_roles_org_seq_vrange_uidx on person_roles tpr (cost=0.56..3.58 rows=1 width=33) (actual rows= loops=)

  • Index Cond: ((organization_uuid = '02ea59bf-4c3c-42e1-8f47-1d037f8755b9'::uuid) AND (person_uuid = p.person_uuid))
  • Filter: upper_inf(valid_range)
23. 0.000 0.000 ↓ 0.0

Result (cost=0.00..2.27 rows=100 width=16) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

ProjectSet (cost=0.00..0.52 rows=100 width=32) (actual rows= loops=)

25. 0.000 0.000 ↓ 0.0

Result (cost=0.00..0.01 rows=1 width=0) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Index Scan using person_roles_org_seq_vrange_uidx on person_roles person_roles_1 (cost=0.56..3.58 rows=1 width=0) (actual rows= loops=)

  • Index Cond: ((organization_uuid = '02ea59bf-4c3c-42e1-8f47-1d037f8755b9'::uuid) AND (person_uuid = p.person_uuid))
  • Filter: (is_super_admin AND upper_inf(valid_range))
27. 0.000 0.000 ↓ 0.0

Index Scan using person_roles_organization_uuid_idx on person_roles person_roles_2 (cost=0.56..2,560.00 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (organization_uuid = '02ea59bf-4c3c-42e1-8f47-1d037f8755b9'::uuid)
  • Filter: (is_super_admin AND upper_inf(valid_range))
28. 0.000 0.000 ↓ 0.0

Index Scan using person_roles_org_seq_vrange_uidx on person_roles pr (cost=0.56..0.68 rows=1 width=77) (actual rows= loops=)

  • Index Cond: ((organization_uuid = '02ea59bf-4c3c-42e1-8f47-1d037f8755b9'::uuid) AND (person_uuid = p.person_uuid))
  • Filter: upper_inf(valid_range)
29. 0.000 0.000 ↓ 0.0

Result (cost=0.00..2.27 rows=100 width=16) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

ProjectSet (cost=0.00..0.52 rows=100 width=32) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Result (cost=0.00..0.01 rows=1 width=0) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Materialize (cost=1.96..33.73 rows=7 width=57) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on roles role (cost=1.96..33.70 rows=7 width=57) (actual rows= loops=)

  • Recheck Cond: (organization_uuid = '02ea59bf-4c3c-42e1-8f47-1d037f8755b9'::uuid)
  • Filter: upper_inf(valid_range)
34. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on roles_organization_uuid_idx (cost=0.00..1.96 rows=22 width=0) (actual rows= loops=)

  • Index Cond: (organization_uuid = '02ea59bf-4c3c-42e1-8f47-1d037f8755b9'::uuid)