explain.depesz.com

PostgreSQL's explain analyze made readable

Result: DJ6y

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 32.079 ↓ 10.0 10 1

CTE Scan on view (cost=238.43..238.45 rows=1 width=296) (actual time=31.507..32.079 rows=10 loops=1)

2.          

CTE base

3. 31.400 31.400 ↓ 10.0 10 1

Sort (cost=8.38..8.38 rows=1 width=16) (actual time=31.398..31.400 rows=10 loops=1)

4. 31.226 31.226 ↓ 10.0 10 1

Nested Loop Semi Join (cost=0.70..12.23 rows=1 width=16) (actual time=6.459..31.226 rows=10 loops=1)

5. 30.634 30.634 ↓ 156.0 156 1

Nested Loop (cost=124.83..141.24 rows=1 width=16) (actual time=6.040..30.634 rows=156 loops=1)

6. 0.000 32.074 ↓ 10.0 10 1

Limit (cost=0.00..76.58 rows=1 width=48) (actual time=31.506..32.074 rows=10 loops=1)

  • Sort Method: quicksort Memory: 25kB
  • Sort Key: ((SubPlan 4))
  • Join Filter: (base.id = attribute_value_1.target_id)
7. 32.074 32.074 ↓ 10.0 10 1

WindowAgg (cost=0.00..76.58 rows=1 width=48) (actual time=31.506..32.074 rows=10 loops=1)

8. 31.387 31.387 ↓ 10.0 10 1

Subquery Scan on alias_87432128 (cost=0.02..8.37 rows=1 width=16) (actual time=31.268..31.387 rows=10 loops=1)

9. 31.118 31.118 ↓ 51.0 51 1

Nested Loop Semi Join (cost=0.42..10.21 rows=1 width=48) (actual time=6.069..31.118 rows=51 loops=1)

10. 30.437 30.437 ↓ 156.0 156 1

Nested Loop Anti Join (cost=0.29..8.68 rows=1 width=16) (actual time=6.034..30.437 rows=156 loops=1)

11. 0.102 0.102 ↓ 0.0 0 51

Index Scan using pk_attribute_value on attribute_value attribute_value_1 (cost=0.28..2.00 rows=1 width=16) (actual time=0.002..0.002 rows=0 loops=51)

12. 0.000 0.156 ↑ 1.0 1 156

Index Only Scan using pk_person on person person_1 (cost=0.27..8.29 rows=1 width=16) (actual time=0.001..0.001 rows=1 loops=156)

13. 0.000 30.097 ↓ 156.0 156 1

Nested Loop (cost=81.91..124.27 rows=1 width=16) (actual time=6.029..30.097 rows=156 loops=1)

  • Rows Removed by Filter: 1
  • Join Filter: (base.id = attribute_value.target_id)
  • Index Cond: (id = pit."PERSON_ID")
  • Index Cond: ((target_id = person_2.id) AND (type = 'PERSON'::text) AND (attribute_id = 'da99ffba-6349-09bf-4ebf-43073faf1431'::uuid))
  • Heap Fetches: 156
  • Filter: (lower(value) = 'false'::text)
14. 0.312 0.312 ↓ 0.0 0 156

Nested Loop (cost=0.29..8.65 rows=1 width=16) (actual time=0.002..0.002 rows=0 loops=156)

15. 30.819 30.819 ↓ 156.0 156 1

Nested Loop (cost=0.14..8.19 rows=1 width=32) (actual time=6.042..30.819 rows=156 loops=1)

16. 0.312 0.312 ↓ 0.0 0 156

Index Scan using pk_attribute_value on attribute_value (cost=0.28..2.00 rows=1 width=16) (actual time=0.002..0.002 rows=0 loops=156)

17. 31.241 31.241 ↓ 10.0 10 1

HashAggregate (cost=0.02..0.03 rows=1 width=16) (actual time=31.240..31.241 rows=10 loops=1)

18. 30.139 30.139 ↓ 156.0 156 1

CTE Scan on pit (cost=0.00..0.02 rows=1 width=16) (actual time=6.029..30.139 rows=156 loops=1)

19. 0.604 31.404 ↓ 10.0 10 1

CTE Scan on match (cost=0.00..0.02 rows=1 width=48) (actual time=31.398..31.404 rows=10 loops=1)

20. 0.120 0.120 ↑ 1.0 1 10

Seq Scan on person person_5 (cost=0.00..8.32 rows=1 width=12) (actual time=0.006..0.012 rows=1 loops=10)

21. 0.140 0.140 ↑ 1.0 1 10

Seq Scan on person person_4 (cost=0.00..8.32 rows=1 width=7) (actual time=0.007..0.014 rows=1 loops=10)

22. 0.130 0.130 ↑ 1.0 1 10

Seq Scan on person person_3 (cost=0.00..8.32 rows=1 width=8) (actual time=0.006..0.013 rows=1 loops=10)

23. 29.914 29.914 ↓ 156.0 156 1

Nested Loop (cost=81.77..116.09 rows=1 width=32) (actual time=6.025..29.914 rows=156 loops=1)

24. 0.080 0.080 ↑ 1.0 1 10

Limit (cost=16.60..16.61 rows=1 width=60) (actual time=0.008..0.008 rows=1 loops=10)

25. 0.110 0.110 ↑ 1.0 1 10

Limit (cost=13.35..13.36 rows=1 width=12) (actual time=0.011..0.011 rows=1 loops=10)

26. 0.100 0.100 ↑ 1.0 1 10

Limit (cost=13.32..13.33 rows=1 width=16) (actual time=0.010..0.010 rows=1 loops=10)

27. 0.156 0.156 ↑ 1.0 1 156

Index Scan using pk_organizational_hierarchy on organizational_hierarchy (cost=0.15..8.17 rows=1 width=16) (actual time=0.001..0.001 rows=1 loops=156)

28. 0.020 0.020 ↑ 1.0 1 10

Index Scan using pk_attribute_value on attribute_value attribute_value_3 (cost=0.28..8.30 rows=1 width=28) (actual time=0.001..0.002 rows=1 loops=10)

29. 0.000 0.030 ↑ 1.0 1 10

Index Scan using pk_attribute_value on attribute_value attribute_value_2 (cost=0.28..8.30 rows=1 width=28) (actual time=0.003..0.003 rows=1 loops=10)

  • Index Cond: ((target_id = person_2.id) AND (type = 'PERSON'::text) AND (attribute_id = 'ba8d4720-ef02-4dc2-8c6f-683d16d63c5e'::uuid))
  • Group Key: "list-condition-0".id
  • Filter: (lower(value) = 'true'::text)
30. 0.156 0.156 ↓ 0.0 0 156

Index Scan using person_type_pkey on person_type person_type_1 (cost=0.15..0.48 rows=1 width=16) (actual time=0.001..0.001 rows=0 loops=156)

31. 0.156 0.156 ↑ 1.0 1 156

Index Scan using person_to_person_type_person_idx on person_to_person_type person_to_person_type_1 (cost=0.14..8.16 rows=1 width=32) (actual time=0.001..0.001 rows=1 loops=156)

32. 0.156 0.156 ↑ 1.0 1 156

Index Scan using person_id_active_idx on person person_2 (cost=0.14..8.16 rows=1 width=16) (actual time=0.001..0.001 rows=1 loops=156)

33. 30.671 30.671 ↓ 156.0 156 1

CTE Scan on base (cost=0.00..0.02 rows=1 width=16) (actual time=6.041..30.671 rows=156 loops=1)

34. 1.082 31.229 ↓ 10.0 10 1

CTE Scan on "list-condition-0" (cost=0.00..0.02 rows=1 width=16) (actual time=6.459..31.229 rows=10 loops=1)

  • Rows Removed by Filter: 185
  • Rows Removed by Filter: 185
  • Rows Removed by Filter: 185
  • Index Cond: (id = organizational_unit.organizational_hierarchy_id)
  • Index Cond: ((target_id = match.record_id) AND (type = 'PERSON'::text) AND (attribute_id = 'da99ffba-6349-09bf-4ebf-43073faf1431'::uuid))
  • Index Cond: ((target_id = match.record_id) AND (type = 'PERSON'::text) AND (attribute_id = 'ba8d4720-ef02-4dc2-8c6f-683d16d63c5e'::uuid))
  • Filter: (state = 'ACTIVE'::text)
  • Filter: (id = match.record_id)
  • Filter: (id = match.record_id)
  • Filter: (id = alias_87432128.record_id)
35. 0.070 0.070 ↑ 1.0 1 10

Sort (cost=16.60..16.61 rows=1 width=60) (actual time=0.007..0.007 rows=1 loops=10)

36. 0.110 0.110 ↑ 1.0 1 10

Sort (cost=13.35..13.36 rows=1 width=12) (actual time=0.011..0.011 rows=1 loops=10)

37. 0.090 0.090 ↑ 1.0 1 10

Sort (cost=13.32..13.33 rows=1 width=16) (actual time=0.009..0.009 rows=1 loops=10)

38. 29.721 29.721 ↓ 156.0 156 1

Nested Loop (cost=81.62..107.91 rows=1 width=32) (actual time=6.020..29.721 rows=156 loops=1)

39. 0.000 0.156 ↑ 1.0 1 156

Index Scan using person_id_active_idx on person (cost=0.14..8.16 rows=1 width=16) (actual time=0.001..0.001 rows=1 loops=156)

  • Rows Removed by Filter: 1
  • Index Cond: (person_id = pit."PERSON_ID")
  • Index Cond: (id = person_to_person_type_1.person_type_id)
  • Index Cond: (id = base.id)
  • Filter: (base_type = 'INTERNAL'::text)
  • Sort Method: quicksort Memory: 25kB
  • Sort Method: quicksort Memory: 25kB
  • Sort Method: quicksort Memory: 25kB
  • Sort Key: employee_3.sort_code
  • Sort Key: employee_2.sort_code
  • Sort Key: employee_1.sort_code
  • Rows Removed by Join Filter: 1716
  • Join Filter: (organizational_unit.id = person_assignment.organizational_unit_id)
  • Index Cond: (id = alias_755097.person_id)
40. 7.488 7.488 ↑ 1.0 1 1,872

Seq Scan on person_assignment (cost=0.00..1.44 rows=1 width=16) (actual time=0.003..0.004 rows=1 loops=1,872)

41. 21.326 21.326 ↓ 1,872.0 1,872 1

Nested Loop (cost=81.62..106.47 rows=1 width=48) (actual time=0.660..21.326 rows=1,872 loops=1)

42. 0.100 0.100 ↑ 1.0 1 10

Nested Loop (cost=0.96..13.34 rows=1 width=12) (actual time=0.008..0.010 rows=1 loops=10)

43. 0.080 0.080 ↑ 1.0 1 10

Nested Loop (cost=0.96..13.31 rows=1 width=16) (actual time=0.007..0.008 rows=1 loops=10)

44. 0.000 0.050 ↑ 1.0 1 10

Nested Loop (cost=0.54..16.59 rows=1 width=60) (actual time=0.005..0.005 rows=1 loops=10)

  • Rows Removed by Filter: 28
  • Filter: ((state = 'ACTIVE'::text) AND (person_id = '8e459ecd-2208-44b9-836a-b9bbf182ec03'::uuid))
45. 21.112 21.112 ↓ 72.0 72 26

Nested Loop Anti Join (cost=81.47..98.29 rows=1 width=16) (actual time=0.578..0.812 rows=72 loops=26)

46. 0.070 0.070 ↑ 1.0 1 10

Nested Loop (cost=0.81..13.05 rows=1 width=20) (actual time=0.006..0.007 rows=1 loops=10)

47. 0.060 0.060 ↑ 1.0 1 10

Nested Loop (cost=0.81..13.03 rows=1 width=32) (actual time=0.005..0.006 rows=1 loops=10)

48. 0.011 0.011 ↑ 1.0 1 11

Index Scan using pk_communication_data_type on communication_data_type (cost=0.15..0.27 rows=1 width=16) (actual time=0.001..0.001 rows=1 loops=11)

49. 0.022 0.022 ↑ 1.0 1 11

Index Scan using organization_id_state_idx on organization (cost=0.27..8.29 rows=1 width=72) (actual time=0.002..0.002 rows=1 loops=11)

50. 0.011 0.011 ↓ 26.0 26 1

Index Scan using idx_organizational_unit_state on organizational_unit (cost=0.15..8.17 rows=1 width=64) (actual time=0.005..0.011 rows=26 loops=1)

51. 0.020 0.020 ↑ 1.0 1 10

Index Scan using employee_person_id_state_idx on employee employee_1 (cost=0.27..8.29 rows=1 width=20) (actual time=0.002..0.002 rows=1 loops=10)

52. 0.000 0.022 ↑ 1.0 1 11

Index Scan using address_pkey on address (cost=0.14..0.29 rows=1 width=24) (actual time=0.002..0.002 rows=1 loops=11)

  • Index Cond: (state = 'ACTIVE'::text)
  • Index Cond: (id = organization_communication_data.communication_data_type_id)
  • Index Cond: (id = organization_address.address_id)
  • Index Cond: ((person_id = match.record_id) AND (state = 'ACTIVE'::text))
  • Index Cond: ((id = employee_1.organization_id) AND (state = 'ACTIVE'::text))
  • Filter: (base_type = 'PHONE'::text)
53. 17.212 17.212 ↓ 72.0 72 26

Subquery Scan on alias_755097 (cost=81.18..81.28 rows=1 width=16) (actual time=0.575..0.662 rows=72 loops=26)

54. 0.030 0.030 ↑ 1.0 1 10

Nested Loop (cost=0.54..12.59 rows=1 width=36) (actual time=0.003..0.003 rows=1 loops=10)

55. 0.030 0.030 ↑ 1.0 1 10

Nested Loop (cost=0.54..12.59 rows=1 width=36) (actual time=0.003..0.003 rows=1 loops=10)

56. 3.744 3.744 ↓ 0.0 0 1,872

Nested Loop (cost=0.29..8.65 rows=1 width=16) (actual time=0.002..0.002 rows=0 loops=1,872)

57. 0.022 0.022 ↑ 1.0 1 11

Index Scan using pk_organization_address on organization_address (cost=0.27..0.44 rows=1 width=32) (actual time=0.002..0.002 rows=1 loops=11)

58. 0.000 0.022 ↑ 1.0 1 11

Index Scan using organization_communication_data_organization_id_idx on organization_communication_data (cost=0.27..0.42 rows=1 width=44) (actual time=0.002..0.002 rows=1 loops=11)

  • Rows Removed by Filter: 76
  • Index Cond: (organization_id = organization_2.id)
  • Index Cond: ((organization_id = organization_1.id) AND (address_type = 'STANDARD'::text))
  • Filter: (alias_755097.r = 1)
59. 16.874 16.874 ↓ 49.3 148 26

WindowAgg (cost=81.18..81.24 rows=3 width=20) (actual time=0.575..0.649 rows=148 loops=26)

60. 1.872 1.872 ↓ 0.0 0 1,872

Index Scan using person_type_pkey on person_type (cost=0.15..0.48 rows=1 width=16) (actual time=0.001..0.001 rows=0 loops=1,872)

61. 1.872 1.872 ↑ 1.0 1 1,872

Index Scan using person_to_person_type_person_idx on person_to_person_type (cost=0.14..8.16 rows=1 width=32) (actual time=0.001..0.001 rows=1 loops=1,872)

62. 0.010 0.010 ↑ 1.0 1 10

Index Scan using employee_person_id_state_idx on employee employee_3 (cost=0.27..8.29 rows=1 width=20) (actual time=0.001..0.001 rows=1 loops=10)

63. 0.010 0.010 ↑ 1.0 1 10

Index Scan using employee_person_id_state_idx on employee employee_2 (cost=0.27..8.29 rows=1 width=20) (actual time=0.001..0.001 rows=1 loops=10)

64. 0.011 0.011 ↑ 1.0 1 11

Index Only Scan using organization_id_state_idx on organization organization_2 (cost=0.27..4.29 rows=1 width=16) (actual time=0.000..0.001 rows=1 loops=11)

65. 0.000 0.011 ↑ 1.0 1 11

Index Only Scan using organization_id_state_idx on organization organization_1 (cost=0.27..4.29 rows=1 width=16) (actual time=0.001..0.001 rows=1 loops=11)

  • Rows Removed by Filter: 1
  • Index Cond: (person_id = alias_755097.person_id)
  • Index Cond: (id = person_to_person_type.person_type_id)
  • Index Cond: ((person_id = match.record_id) AND (state = 'ACTIVE'::text))
  • Index Cond: ((person_id = match.record_id) AND (state = 'ACTIVE'::text))
  • Index Cond: ((id = employee_3.organization_id) AND (state = 'ACTIVE'::text))
  • Index Cond: ((id = employee_2.organization_id) AND (state = 'ACTIVE'::text))
  • Heap Fetches: 0
  • Heap Fetches: 0
  • Filter: (base_type = 'INTERNAL'::text)
66. 1.404 15.236 ↓ 49.3 148 26

Sort (cost=81.18..81.19 rows=3 width=20) (actual time=0.571..0.586 rows=148 loops=26)

  • Sort Method: quicksort Memory: 90kB
  • Sort Key: employee.person_id, employee.sort_code
67. 0.000 13.832 ↓ 49.3 148 26

Nested Loop (cost=20.17..81.16 rows=3 width=20) (actual time=0.030..0.532 rows=148 loops=26)

68. 3.900 3.900 ↓ 49.5 396 26

Nested Loop (cost=19.90..78.12 rows=8 width=16) (actual time=0.028..0.150 rows=396 loops=26)

69. 7.574 10.304 ↓ 0.0 0 10,304

Index Scan using employee_organization_id_state_idx on employee (cost=0.27..0.35 rows=3 width=36) (actual time=0.001..0.001 rows=0 loops=10,304)

  • Index Cond: ((organization_id = organization_assignment.organization_id) AND (state = 'ACTIVE'::text))
70. 0.286 0.286 ↓ 4.0 4 26

Index Scan using idx_organizational_unit_state on organizational_unit ou2 (cost=0.15..8.17 rows=1 width=16) (actual time=0.004..0.011 rows=4 loops=26)

71. 1.692 2.444 ↑ 4.1 110 94

Bitmap Heap Scan on organization_assignment (cost=19.75..65.47 rows=448 width=32) (actual time=0.010..0.026 rows=110 loops=94)

  • Rows Removed by Filter: 22
  • Recheck Cond: ((organizational_unit_id = ou2.id) AND (state = 'ACTIVE'::text))
  • Index Cond: (state = 'ACTIVE'::text)
  • Heap Blocks: exact=897
  • Filter: (materialized_path @> organizational_unit.materialized_path)
72. 0.752 0.752 ↑ 4.1 110 94

Bitmap Index Scan on organizational_assignment_org_unit_id_org_id_idx (cost=0.00..19.64 rows=448 width=0) (actual time=0.008..0.008 rows=110 loops=94)

  • Index Cond: (organizational_unit_id = ou2.id)
Planning time : 4.994 ms
Execution time : 32.432 ms