explain.depesz.com

PostgreSQL's explain analyze made readable

Result: BdLD

Settings
# exclusive inclusive rows x rows loops node
1. 11.656 15,554.187 ↑ 1.0 1 1

Aggregate (cost=23,861.23..23,861.24 rows=1 width=8) (actual time=15,554.187..15,554.187 rows=1 loops=1)

2.          

Initplan (for Aggregate)

3. 0.001 0.023 ↓ 0.0 0 1

Append (cost=0.41..4.12 rows=1 width=0) (actual time=0.023..0.023 rows=0 loops=1)

4. 0.022 0.022 ↓ 0.0 0 1

Index Scan using person_roles_org_part_72_organization_uuid_person_uuid_sequ_idx on person_roles_org_part_72 (cost=0.41..4.11 rows=1 width=0) (actual time=0.022..0.022 rows=0 loops=1)

  • Index Cond: ((organization_uuid = '9179fd37-1322-4957-8a99-7e2056388b4f'::uuid) AND (person_uuid = '981387e3-9d1a-4d83-bd44-8866e911710b'::uuid))
  • Filter: (is_company_admin AND upper_inf(valid_range))
  • Rows Removed by Filter: 2
5. 10.475 15,542.508 ↑ 1.8 8,655 1

Hash Left Join (cost=16,420.47..23,818.26 rows=15,542 width=16) (actual time=1,687.600..15,542.508 rows=8,655 loops=1)

  • Hash Cond: (p.person_uuid = pr.person_uuid)
6. 8,150.580 13,998.060 ↓ 11.4 6,011 1

Nested Loop Left Join (cost=10,640.18..17,493.44 rows=526 width=16) (actual time=153.579..13,998.060 rows=6,011 loops=1)

  • Join Filter: (tpr.person_uuid = p.person_uuid)
  • Rows Removed by Join Filter: 103,684,214
  • Filter: ((p.person_uuid = '981387e3-9d1a-4d83-bd44-8866e911710b'::uuid) OR $0 OR (tpr.person_uuid IS NOT NULL))
  • Rows Removed by Filter: 9,491
7. 2.086 227.280 ↓ 23.3 12,325 1

Nested Loop Anti Join (cost=10,639.12..16,755.42 rows=528 width=16) (actual time=119.294..227.280 rows=12,325 loops=1)

  • Join Filter: (adm.person_uuid = p.person_uuid)
8. 2.754 212.869 ↓ 11.7 12,325 1

Append (cost=10,639.12..16,134.87 rows=1,056 width=16) (actual time=113.840..212.869 rows=12,325 loops=1)

9. 96.424 210.115 ↓ 11.7 12,325 1

Bitmap Heap Scan on persons_org_part_default p (cost=10,639.12..16,129.59 rows=1,056 width=16) (actual time=113.839..210.115 rows=12,325 loops=1)

  • Recheck Cond: ((organization_uuid = '9179fd37-1322-4957-8a99-7e2056388b4f'::uuid) AND (valid_range @> '2019-09-29 01:19:31+00'::timestamp with time zone))
  • Filter: ((is_visible IS TRUE) AND (((first_name)::text ~~* '%st%'::text) OR ((last_name)::text ~~* '%st%'::text) OR ((target_name)::text ~~* '%st%'::text) OR ((web_login)::text ~~ '%st%'::text)))
  • Rows Removed by Filter: 5,194
  • Heap Blocks: exact=652
10. 1.177 113.691 ↓ 0.0 0 1

BitmapAnd (cost=10,639.12..10,639.12 rows=4,013 width=0) (actual time=113.691..113.691 rows=0 loops=1)

11. 2.732 2.732 ↑ 1.1 19,775 1

Bitmap Index Scan on persons_org_part_default_pkey (cost=0.00..359.83 rows=21,120 width=0) (actual time=2.732..2.732 rows=19,775 loops=1)

  • Index Cond: (organization_uuid = '9179fd37-1322-4957-8a99-7e2056388b4f'::uuid)
12. 109.782 109.782 ↑ 1.0 433,947 1

Bitmap Index Scan on persons_org_part_default_valid_range_idx (cost=0.00..10,278.51 rows=444,213 width=0) (actual time=109.782..109.782 rows=433,947 loops=1)

  • Index Cond: (valid_range @> '2019-09-29 01:19:31+00'::timestamp with time zone)
13. 6.887 12.325 ↓ 0.0 0 12,325

Materialize (cost=0.00..604.70 rows=1 width=16) (actual time=0.001..0.001 rows=0 loops=12,325)

14. 0.003 5.438 ↓ 0.0 0 1

Append (cost=0.00..604.70 rows=1 width=16) (actual time=5.438..5.438 rows=0 loops=1)

15. 5.435 5.435 ↓ 0.0 0 1

Seq Scan on person_roles_org_part_72 adm (cost=0.00..604.69 rows=1 width=16) (actual time=5.435..5.435 rows=0 loops=1)

  • Filter: (is_super_admin AND upper_inf(valid_range) AND (organization_uuid = '9179fd37-1322-4957-8a99-7e2056388b4f'::uuid))
  • Rows Removed by Filter: 17,726
16. 5,601.940 5,620.200 ↓ 1,402.2 8,413 12,325

Materialize (cost=1.06..682.60 rows=6 width=16) (actual time=0.000..0.456 rows=8,413 loops=12,325)

17. 0.792 18.260 ↓ 1,402.2 8,413 1

Nested Loop (cost=1.06..682.57 rows=6 width=16) (actual time=0.394..18.260 rows=8,413 loops=1)

18. 0.736 1.286 ↓ 31.0 31 1

Nested Loop (cost=0.84..678.75 rows=1 width=16) (actual time=0.289..1.286 rows=31 loops=1)

  • Join Filter: (spr.roles @> ((('[""'::text || (rr.source_role_uuid)::text) || '""]'::text))::jsonb)
  • Rows Removed by Join Filter: 619
19. 0.002 0.060 ↑ 1.0 1 1

Append (cost=0.41..4.12 rows=1 width=43) (actual time=0.056..0.060 rows=1 loops=1)

20. 0.058 0.058 ↑ 1.0 1 1

Index Scan using person_roles_org_part_72_organization_uuid_person_uuid_sequ_idx on person_roles_org_part_72 spr (cost=0.41..4.11 rows=1 width=43) (actual time=0.055..0.058 rows=1 loops=1)

  • Index Cond: ((organization_uuid = '9179fd37-1322-4957-8a99-7e2056388b4f'::uuid) AND (person_uuid = '981387e3-9d1a-4d83-bd44-8866e911710b'::uuid))
  • Filter: upper_inf(valid_range)
  • Rows Removed by Filter: 1
21. 0.490 0.490 ↓ 3.8 650 1

Index Scan using role_on_role_organization_uuid_idx on role_on_role rr (cost=0.42..669.93 rows=171 width=32) (actual time=0.057..0.490 rows=650 loops=1)

  • Index Cond: (organization_uuid = '9179fd37-1322-4957-8a99-7e2056388b4f'::uuid)
  • Filter: ((can_edit_person OR can_view_person OR can_use_person) AND upper_inf(valid_range))
  • Rows Removed by Filter: 20
22. 0.713 16.182 ↓ 45.2 271 31

Append (cost=0.22..3.76 rows=6 width=59) (actual time=0.051..0.522 rows=271 loops=31)

23. 14.384 15.469 ↓ 45.2 271 31

Bitmap Heap Scan on person_roles_org_part_72 tpr (cost=0.22..3.73 rows=6 width=59) (actual time=0.048..0.499 rows=271 loops=31)

  • Recheck Cond: (roles @> ((('[""'::text || (rr.target_role_uuid)::text) || '""]'::text))::jsonb)
  • Filter: (upper_inf(valid_range) AND (organization_uuid = '9179fd37-1322-4957-8a99-7e2056388b4f'::uuid))
  • Rows Removed by Filter: 2
  • Heap Blocks: exact=2,676
24. 1.085 1.085 ↓ 15.2 273 31

Bitmap Index Scan on person_roles_org_part_72_roles_idx (cost=0.00..0.22 rows=18 width=0) (actual time=0.035..0.035 rows=273 loops=31)

  • Index Cond: (roles @> ((('[""'::text || (rr.target_role_uuid)::text) || '""]'::text))::jsonb)
25. 12.086 1,533.973 ↓ 3.3 19,319 1

Hash (cost=5,706.50..5,706.50 rows=5,904 width=16) (actual time=1,533.973..1,533.973 rows=19,319 loops=1)

  • Buckets: 32,768 (originally 8192) Batches: 1 (originally 1) Memory Usage: 1,162kB
26. 1,419.982 1,521.887 ↓ 3.3 19,319 1

Nested Loop Left Join (cost=2.42..5,706.50 rows=5,904 width=16) (actual time=0.243..1,521.887 rows=19,319 loops=1)

  • Join Filter: (pr.roles @> ((('[""'::text || (role.role_uuid)::text) || '""]'::text))::jsonb)
  • Rows Removed by Join Filter: 1,444,112
27. 1.718 13.885 ↓ 3.0 17,604 1

Append (cost=0.00..634.21 rows=5,904 width=59) (actual time=0.023..13.885 rows=17,604 loops=1)

28. 12.167 12.167 ↓ 3.0 17,604 1

Seq Scan on person_roles_org_part_72 pr (cost=0.00..604.69 rows=5,904 width=59) (actual time=0.022..12.167 rows=17,604 loops=1)

  • Filter: (upper_inf(valid_range) AND (organization_uuid = '9179fd37-1322-4957-8a99-7e2056388b4f'::uuid))
  • Rows Removed by Filter: 122
29. 87.899 88.020 ↓ 3.0 83 17,604

Materialize (cost=2.42..112.99 rows=28 width=16) (actual time=0.000..0.005 rows=83 loops=17,604)

30. 0.066 0.121 ↓ 3.0 83 1

Bitmap Heap Scan on roles role (cost=2.42..112.85 rows=28 width=16) (actual time=0.071..0.121 rows=83 loops=1)

  • Recheck Cond: (organization_uuid = '9179fd37-1322-4957-8a99-7e2056388b4f'::uuid)
  • Filter: upper_inf(valid_range)
  • Rows Removed by Filter: 3
  • Heap Blocks: exact=4
31. 0.055 0.055 ↓ 1.0 86 1

Bitmap Index Scan on roles_organization_uuid_idx (cost=0.00..2.41 rows=83 width=0) (actual time=0.055..0.055 rows=86 loops=1)

  • Index Cond: (organization_uuid = '9179fd37-1322-4957-8a99-7e2056388b4f'::uuid)
Planning time : 459.676 ms
Execution time : 15,555.169 ms