explain.depesz.com

PostgreSQL's explain analyze made readable

Result: u6JM

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

Limit (cost=17,588,317,650.28..17,588,317,650.48 rows=40 width=569) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Unique (cost=17,588,317,650.28..17,591,199,504.78 rows=576,370,900 width=569) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Sort (cost=17,588,317,650.28..17,589,758,577.53 rows=576,370,900 width=569) (actual rows= loops=)

  • Sort Key: p.person_uuid, p.first_name, p.last_name, (lower(pr.valid_range)) DESC, pr.sequence DESC
4. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=17,081,288,892.24..17,124,516,709.74 rows=576,370,900 width=569) (actual rows= loops=)

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

Sort (cost=17,081,288,892.24..17,082,729,819.49 rows=576,370,900 width=570) (actual rows= loops=)

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

Nested Loop Left Join (cost=2.52..16,617,487,951.70 rows=576,370,900 width=570) (actual rows= loops=)

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

Nested Loop Left Join (cost=0.56..16,556,968,973.48 rows=576,370,900 width=529) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.56..16,532,372,345.33 rows=5,763,709 width=546) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Seq Scan on persons p (cost=0.00..16,528,104,120.47 rows=5,763,709 width=485) (actual rows= loops=)

  • Filter: (((organization_uuid = '02ea59bf-4c3c-42e1-8f47-1d037f8755b9'::uuid) AND (valid_range @> '2019-08-08 22:57:26+00'::timestamp with time zone) AND (is_visible IS TRUE) AND (((first_name)::text ~~* '%hpomi%'::text) OR (
10.          

SubPlan (for Seq Scan)

11. 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)
12. 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))
13. 0.000 0.000 ↓ 0.0

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

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

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

15. 0.000 0.000 ↓ 0.0

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

16. 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)
17. 0.000 0.000 ↓ 0.0

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

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

Index Scan using role_on_role_organization_uuid_idx on role_on_role rr (cost=0.42..181.59 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))
19. 0.000 0.000 ↓ 0.0

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

20. 0.000 0.000 ↓ 0.0

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

21. 0.000 0.000 ↓ 0.0

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

22. 0.000 0.000 ↓ 0.0

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

23. 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)
24. 0.000 0.000 ↓ 0.0

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

25. 0.000 0.000 ↓ 0.0

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

26. 0.000 0.000 ↓ 0.0

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

27. 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))
28. 0.000 0.000 ↓ 0.0

Index Scan using person_roles_organization_uuid_idx on person_roles person_roles_2 (cost=0.56..2,525.45 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))
29. 0.000 0.000 ↓ 0.0

Index Scan using person_roles_org_seq_vrange_uidx on person_roles pr (cost=0.56..0.73 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)
30. 0.000 0.000 ↓ 0.0

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

31. 0.000 0.000 ↓ 0.0

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

32. 0.000 0.000 ↓ 0.0

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

33. 0.000 0.000 ↓ 0.0

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

34. 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)
35. 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)