explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xdDAV

Settings
# exclusive inclusive rows x rows loops node
1. 8.604 1,047.374 ↓ 3,030.0 3,030 1

Nested Loop (cost=961.93..20,710.45 rows=1 width=673) (actual time=880.746..1,047.374 rows=3,030 loops=1)

  • Join Filter: (x."CodeDimension" = (dimensions.acronym)::text)
  • Rows Removed by Join Filter: 90
2.          

CTE x

3. 2.647 2.650 ↓ 30.3 3,028 1

ProjectSet (cost=0.00..0.52 rows=100 width=96) (actual time=0.011..2.650 rows=3,028 loops=1)

4. 0.003 0.003 ↑ 1.0 1 1

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

5. 6.829 1,032.530 ↓ 3,120.0 3,120 1

Nested Loop (cost=961.27..20,701.56 rows=1 width=160) (actual time=880.720..1,032.530 rows=3,120 loops=1)

6. 6.715 1,019.461 ↓ 3,120.0 3,120 1

Nested Loop (cost=961.13..20,701.23 rows=1 width=128) (actual time=880.651..1,019.461 rows=3,120 loops=1)

7. 5.530 1,006.506 ↓ 3,120.0 3,120 1

Hash Join (cost=960.98..20,700.90 rows=1 width=96) (actual time=880.630..1,006.506 rows=3,120 loops=1)

  • Hash Cond: ((vp.entity_id = entities.id) AND (x."CodeEntity" = (entities.code)::text))
8. 6.631 1,000.882 ↓ 21.7 3,120 1

Hash Left Join (cost=959.85..20,699.02 rows=144 width=96) (actual time=880.525..1,000.882 rows=3,120 loops=1)

  • Hash Cond: ((variables.id = "UserVariableResponsible".variable_id) AND (vp.entity_id = "UserVariableResponsible".entity_id) AND (entity_variable_dimensions.dimension_id = "UserVariableResponsible".dimension_id) AND (COALESCE(vp.entity_unit_id, 0) = COALESCE("UserVariableResponsible".entity_unit_id, 0)))
9. 6.208 124.385 ↓ 21.7 3,120 1

Hash Join (cost=29.69..19,766.68 rows=144 width=92) (actual time=10.645..124.385 rows=3,120 loops=1)

  • Hash Cond: ((variables.code)::text = x."CodeVariable")
10. 4.370 107.684 ↓ 10.7 3,086 1

Append (cost=26.44..19,760.91 rows=289 width=28) (actual time=0.140..107.684 rows=3,086 loops=1)

11. 8.903 89.525 ↓ 3,078.0 3,078 1

Nested Loop (cost=26.44..9,813.26 rows=1 width=28) (actual time=0.138..89.525 rows=3,078 loops=1)

12. 11.802 74.466 ↓ 3,078.0 3,078 1

Nested Loop (cost=26.16..9,806.29 rows=1 width=16) (actual time=0.126..74.466 rows=3,078 loops=1)

  • Join Filter: (entity_dimensions.entity_id = entity_variables.entity_id)
  • Rows Removed by Join Filter: 3030
13. 7.986 44.340 ↓ 122.2 6,108 1

Hash Join (cost=25.88..9,785.20 rows=50 width=28) (actual time=0.107..44.340 rows=6,108 loops=1)

  • Hash Cond: (entity_variable_dimensions.dimension_id = entity_dimensions.dimension_id)
14. 11.110 36.321 ↓ 146.6 3,078 1

Nested Loop (cost=0.28..9,757.79 rows=21 width=24) (actual time=0.054..36.321 rows=3,078 loops=1)

15. 4.410 16.121 ↓ 144.3 3,030 1

Subquery Scan on vp (cost=0.00..9,643.33 rows=21 width=16) (actual time=0.031..16.121 rows=3,030 loops=1)

  • Filter: (vp.entity_unit_id IS NULL)
  • Rows Removed by Filter: 3
16. 4.594 11.711 ↑ 1.4 3,033 1

Result (cost=0.00..9,601.42 rows=4,191 width=54) (actual time=0.028..11.711 rows=3,033 loops=1)

17. 4.217 7.117 ↑ 1.4 3,033 1

Append (cost=0.00..9,559.51 rows=4,191 width=16) (actual time=0.026..7.117 rows=3,033 loops=1)

18. 2.841 2.841 ↑ 1.0 3,030 1

Seq Scan on entity_variables entityvariables (cost=0.00..72.31 rows=3,031 width=16) (actual time=0.024..2.841 rows=3,030 loops=1)

19. 0.035 0.059 ↑ 386.7 3 1

Seq Scan on entity_unit_variables entityunitvariables (cost=0.00..9,487.20 rows=1,160 width=16) (actual time=0.047..0.059 rows=3 loops=1)

20.          

SubPlan (forSeq Scan)

21. 0.024 0.024 ↑ 1.0 1 3

Index Scan using "EntityUnit_pkey" on entity_units entity_units_1 (cost=0.14..8.16 rows=1 width=4) (actual time=0.007..0.008 rows=1 loops=3)

  • Index Cond: (id = entityunitvariables.entity_unit_id)
22. 9.090 9.090 ↑ 1.0 1 3,030

Index Scan using idx_entity_variable_entity_variable_dimensions on entity_variable_dimensions (cost=0.28..5.44 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=3,030)

  • Index Cond: (entity_variable_id = vp.internal_id)
23. 0.008 0.033 ↑ 96.0 5 1

Hash (cost=19.60..19.60 rows=480 width=8) (actual time=0.032..0.033 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
24. 0.025 0.025 ↑ 96.0 5 1

Seq Scan on entity_dimensions (cost=0.00..19.60 rows=480 width=8) (actual time=0.020..0.025 rows=5 loops=1)

  • Filter: active
  • Rows Removed by Filter: 1
25. 18.324 18.324 ↑ 1.0 1 6,108

Index Scan using entity_variable_pkey on entity_variables (cost=0.28..0.41 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=6,108)

  • Index Cond: (id = entity_variable_dimensions.entity_variable_id)
26. 6.156 6.156 ↑ 1.0 1 3,078

Index Scan using variables_pkey on variables (cost=0.28..6.96 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=3,078)

  • Index Cond: (id = vp.variable_id)
27. 0.024 13.789 ↑ 36.0 8 1

Nested Loop (cost=172.89..9,944.76 rows=288 width=28) (actual time=13.721..13.789 rows=8 loops=1)

28. 0.030 13.741 ↑ 36.0 8 1

Hash Join (cost=172.61..9,834.50 rows=288 width=16) (actual time=13.707..13.741 rows=8 loops=1)

  • Hash Cond: (vp_1.internal_id = entity_unit_variable_dimensions.entity_unit_variable_id)
29. 2.205 13.549 ↑ 1,390.0 3 1

Subquery Scan on vp_1 (cost=0.00..9,643.33 rows=4,170 width=16) (actual time=13.523..13.549 rows=3 loops=1)

  • Filter: (vp_1.entity_unit_id IS NOT NULL)
  • Rows Removed by Filter: 3030
30. 4.494 11.344 ↑ 1.4 3,033 1

Result (cost=0.00..9,601.42 rows=4,191 width=54) (actual time=0.015..11.344 rows=3,033 loops=1)

31. 4.180 6.850 ↑ 1.4 3,033 1

Append (cost=0.00..9,559.51 rows=4,191 width=16) (actual time=0.013..6.850 rows=3,033 loops=1)

32. 2.618 2.618 ↑ 1.0 3,030 1

Seq Scan on entity_variables entityvariables_1 (cost=0.00..72.31 rows=3,031 width=16) (actual time=0.011..2.618 rows=3,030 loops=1)

33. 0.028 0.052 ↑ 386.7 3 1

Seq Scan on entity_unit_variables entityunitvariables_1 (cost=0.00..9,487.20 rows=1,160 width=16) (actual time=0.039..0.052 rows=3 loops=1)

34.          

SubPlan (forSeq Scan)

35. 0.024 0.024 ↑ 1.0 1 3

Index Scan using "EntityUnit_pkey" on entity_units entity_units_2 (cost=0.14..8.16 rows=1 width=4) (actual time=0.007..0.008 rows=1 loops=3)

  • Index Cond: (id = entityunitvariables_1.entity_unit_id)
36. 0.016 0.162 ↑ 1.8 8 1

Hash (cost=172.43..172.43 rows=14 width=12) (actual time=0.161..0.162 rows=8 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
37. 0.024 0.146 ↑ 1.8 8 1

Merge Join (cost=160.07..172.43 rows=14 width=12) (actual time=0.116..0.146 rows=8 loops=1)

  • Merge Cond: ((entity_unit_variables.entity_unit_id = entity_unit_dimensions.entity_unit_id) AND (entity_unit_variable_dimensions.dimension_id = entity_unit_dimensions.dimension_id))
38. 0.027 0.091 ↑ 143.8 8 1

Sort (cost=119.09..121.97 rows=1,150 width=16) (actual time=0.085..0.091 rows=8 loops=1)

  • Sort Key: entity_unit_variables.entity_unit_id, entity_unit_variable_dimensions.dimension_id
  • Sort Method: quicksort Memory: 25kB
39. 0.025 0.064 ↑ 143.8 8 1

Hash Join (cost=36.10..60.63 rows=1,150 width=16) (actual time=0.045..0.064 rows=8 loops=1)

  • Hash Cond: (entity_unit_variable_dimensions.entity_unit_variable_id = entity_unit_variables.id)
40. 0.014 0.014 ↑ 143.8 8 1

Seq Scan on entity_unit_variable_dimensions (cost=0.00..21.50 rows=1,150 width=8) (actual time=0.007..0.014 rows=8 loops=1)

41. 0.018 0.025 ↑ 386.7 3 1

Hash (cost=21.60..21.60 rows=1,160 width=8) (actual time=0.024..0.025 rows=3 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 17kB
42. 0.007 0.007 ↑ 386.7 3 1

Seq Scan on entity_unit_variables (cost=0.00..21.60 rows=1,160 width=8) (actual time=0.004..0.007 rows=3 loops=1)

43. 0.017 0.031 ↑ 68.6 7 1

Sort (cost=40.98..42.18 rows=480 width=8) (actual time=0.025..0.031 rows=7 loops=1)

  • Sort Key: entity_unit_dimensions.entity_unit_id, entity_unit_dimensions.dimension_id
  • Sort Method: quicksort Memory: 25kB
44. 0.014 0.014 ↑ 96.0 5 1

Seq Scan on entity_unit_dimensions (cost=0.00..19.60 rows=480 width=8) (actual time=0.009..0.014 rows=5 loops=1)

  • Filter: active
  • Rows Removed by Filter: 7
45. 0.024 0.024 ↑ 1.0 1 8

Index Scan using variables_pkey on variables variables_1 (cost=0.28..0.38 rows=1 width=16) (actual time=0.003..0.003 rows=1 loops=8)

  • Index Cond: (id = vp_1.variable_id)
46. 2.703 10.493 ↓ 30.3 3,028 1

Hash (cost=2.00..2.00 rows=100 width=96) (actual time=10.493..10.493 rows=3,028 loops=1)

  • Buckets: 4096 (originally 1024) Batches: 1 (originally 1) Memory Usage: 162kB
47. 7.790 7.790 ↓ 30.3 3,028 1

CTE Scan on x (cost=0.00..2.00 rows=100 width=96) (actual time=0.015..7.790 rows=3,028 loops=1)

48. 3.145 869.866 ↓ 763.5 3,054 1

Hash (cost=930.08..930.08 rows=4 width=16) (actual time=869.866..869.866 rows=3,054 loops=1)

  • Buckets: 4096 (originally 1024) Batches: 1 (originally 1) Memory Usage: 164kB
49. 4.451 866.721 ↓ 763.5 3,054 1

Subquery Scan on UserVariableResponsible (cost=929.98..930.08 rows=4 width=16) (actual time=854.752..866.721 rows=3,054 loops=1)

50. 5.136 862.270 ↓ 763.5 3,054 1

Group (cost=929.98..930.04 rows=4 width=532) (actual time=854.748..862.270 rows=3,054 loops=1)

  • Group Key: "entitiesNotDefault".entity_id, "entitiesNotDefault".entity_unit_id, "entitiesNotDefault".dimension_id, "entitiesNotDefault".variable_id, "entitiesNotDefault".user_id
51.          

CTE entitiesNotDefault

52. 0.005 0.811 ↓ 0.0 0 1

Sort (cost=23.47..23.48 rows=1 width=53) (actual time=0.810..0.811 rows=0 loops=1)

  • Sort Key: variables_2.id
  • Sort Method: quicksort Memory: 25kB
53. 0.001 0.806 ↓ 0.0 0 1

Nested Loop (cost=16.61..23.46 rows=1 width=53) (actual time=0.806..0.806 rows=0 loops=1)

54. 0.002 0.805 ↓ 0.0 0 1

Nested Loop Left Join (cost=16.46..23.24 rows=1 width=53) (actual time=0.804..0.805 rows=0 loops=1)

  • Join Filter: (u.id = COALESCE(evdr.user_id, luug.user_id))
55. 0.002 0.803 ↓ 0.0 0 1

Nested Loop Left Join (cost=16.46..22.04 rows=1 width=24) (actual time=0.802..0.803 rows=0 loops=1)

56. 0.002 0.801 ↓ 0.0 0 1

Merge Join (cost=13.21..17.25 rows=1 width=24) (actual time=0.801..0.801 rows=0 loops=1)

  • Merge Cond: (evd.id = evdr.entity_variable_dimension_id)
  • Join Filter: (ugg.id = evdr.user_group_id)
57. 0.002 0.799 ↓ 0.0 0 1

Nested Loop (cost=0.84..198.82 rows=50 width=24) (actual time=0.798..0.799 rows=0 loops=1)

58. 0.001 0.797 ↓ 0.0 0 1

Nested Loop (cost=0.84..187.32 rows=1 width=20) (actual time=0.797..0.797 rows=0 loops=1)

59. 0.002 0.796 ↓ 0.0 0 1

Nested Loop (cost=0.56..186.91 rows=1 width=16) (actual time=0.795..0.796 rows=0 loops=1)

60. 0.794 0.794 ↓ 0.0 0 1

Index Scan using entity_variable_dimensions_pkey on entity_variable_dimensions evd (cost=0.28..178.61 rows=1 width=12) (actual time=0.793..0.794 rows=0 loops=1)

  • Filter: (NOT default_responsibles)
  • Rows Removed by Filter: 3078
61. 0.000 0.000 ↓ 0.0 0

Index Scan using entity_variable_pkey on entity_variables ev (cost=0.28..8.30 rows=1 width=12) (never executed)

  • Index Cond: (id = evd.entity_variable_id)
62. 0.000 0.000 ↓ 0.0 0

Index Scan using variables_pkey on variables variables_2 (cost=0.28..0.41 rows=1 width=8) (never executed)

  • Index Cond: (id = ev.variable_id)
63. 0.000 0.000 ↓ 0.0 0

Seq Scan on user_groups ugg (cost=0.00..11.00 rows=50 width=4) (never executed)

  • Filter: active
64. 0.000 0.000 ↓ 0.0 0

Sort (cost=12.37..12.40 rows=13 width=12) (never executed)

  • Sort Key: evdr.entity_variable_dimension_id
65. 0.000 0.000 ↓ 0.0 0

Seq Scan on entity_variable_dimension_responsibles evdr (cost=0.00..12.13 rows=13 width=12) (never executed)

66. 0.000 0.000 ↓ 0.0 0

Hash Right Join (cost=3.25..4.78 rows=1 width=8) (never executed)

  • Hash Cond: (luug.user_group_id = ug.id)
67. 0.000 0.000 ↓ 0.0 0

Seq Scan on lnk_user_user_groups luug (cost=0.00..1.42 rows=42 width=8) (never executed)

68. 0.000 0.000 ↓ 0.0 0

Hash (cost=3.24..3.24 rows=1 width=4) (never executed)

69. 0.000 0.000 ↓ 0.0 0

Index Only Scan using user_groups_pkey on user_groups ug (cost=0.14..3.24 rows=1 width=4) (never executed)

  • Index Cond: (id = evdr.user_group_id)
  • Heap Fetches: 0
70. 0.000 0.000 ↓ 0.0 0

Seq Scan on users u (cost=0.00..1.09 rows=9 width=41) (never executed)

71. 0.000 0.000 ↓ 0.0 0

Index Scan using variable_types_pkey on variable_types vt (cost=0.15..0.18 rows=1 width=4) (never executed)

  • Index Cond: (id = variables_2.type_id)
  • Filter: ((system_slug)::text = 'base'::text)
72.          

CTE entitiesDefault

73. 145.321 809.261 ↓ 6,253.0 6,253 1

Nested Loop (cost=78.94..349.29 rows=1 width=53) (actual time=2.024..809.261 rows=6,253 loops=1)

  • Join Filter: (ed.dimension_id = evd_1.dimension_id)
  • Rows Removed by Join Filter: 57581
74. 179.374 473.668 ↓ 63,424.0 63,424 1

Nested Loop (cost=78.66..348.92 rows=1 width=53) (actual time=2.009..473.668 rows=63,424 loops=1)

75. 103.555 167.404 ↓ 1,762.4 63,445 1

Hash Join (cost=78.38..324.32 rows=36 width=49) (actual time=1.986..167.404 rows=63,445 loops=1)

  • Hash Cond: (variables_3.type_id = vt_1.id)
76. 59.152 63.834 ↓ 6.3 63,676 1

Hash Join (cost=64.87..283.78 rows=10,146 width=53) (actual time=1.961..63.834 rows=63,676 loops=1)

  • Hash Cond: (variables_3.family_id = edf.family_id)
77. 2.849 2.849 ↑ 1.0 3,033 1

Seq Scan on variables variables_3 (cost=0.00..83.33 rows=3,033 width=12) (actual time=0.010..2.849 rows=3,033 loops=1)

78. 0.226 1.833 ↓ 5.2 237 1

Hash (cost=64.29..64.29 rows=46 width=49) (actual time=1.832..1.833 rows=237 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 27kB
79. 0.401 1.607 ↓ 5.2 237 1

Hash Left Join (cost=60.86..64.29 rows=46 width=49) (actual time=0.476..1.607 rows=237 loops=1)

  • Hash Cond: (COALESCE(ledfr.user_id, luug_1.user_id) = u_1.id)
80. 0.291 1.153 ↓ 5.2 237 1

Hash Left Join (cost=59.66..62.97 rows=46 width=20) (actual time=0.411..1.153 rows=237 loops=1)

  • Hash Cond: (ug_1.id = luug_1.user_group_id)
81. 0.111 0.743 ↓ 1.4 65 1

Hash Left Join (cost=57.71..60.26 rows=46 width=20) (actual time=0.239..0.743 rows=65 loops=1)

  • Hash Cond: (ledfr.user_group_id = ug_1.id)
82. 0.114 0.595 ↓ 1.4 65 1

Hash Join (cost=45.46..47.89 rows=46 width=20) (actual time=0.195..0.595 rows=65 loops=1)

  • Hash Cond: (edf.entity_dimension_id = ed.id)
83. 0.110 0.463 ↓ 1.4 65 1

Hash Join (cost=13.86..16.17 rows=46 width=16) (actual time=0.170..0.463 rows=65 loops=1)

  • Hash Cond: (ledfr.entity_dimension_family_id = edf.id)
84. 0.135 0.253 ↓ 1.4 65 1

Hash Join (cost=11.63..13.80 rows=46 width=12) (actual time=0.062..0.253 rows=65 loops=1)

  • Hash Cond: (ledfr.user_group_id = ugg_1.id)
85. 0.075 0.075 ↑ 1.0 92 1

Seq Scan on lnk_entity_dimension_family_responsibles ledfr (cost=0.00..1.92 rows=92 width=12) (actual time=0.009..0.075 rows=92 loops=1)

86. 0.021 0.043 ↑ 3.3 15 1

Hash (cost=11.00..11.00 rows=50 width=4) (actual time=0.042..0.043 rows=15 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
87. 0.022 0.022 ↑ 3.3 15 1

Seq Scan on user_groups ugg_1 (cost=0.00..11.00 rows=50 width=4) (actual time=0.009..0.022 rows=15 loops=1)

  • Filter: active
  • Rows Removed by Filter: 1
88. 0.048 0.100 ↑ 1.0 55 1

Hash (cost=1.55..1.55 rows=55 width=12) (actual time=0.099..0.100 rows=55 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
89. 0.052 0.052 ↑ 1.0 55 1

Seq Scan on entity_dimension_families edf (cost=0.00..1.55 rows=55 width=12) (actual time=0.011..0.052 rows=55 loops=1)

90. 0.008 0.018 ↑ 160.0 6 1

Hash (cost=19.60..19.60 rows=960 width=12) (actual time=0.017..0.018 rows=6 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
91. 0.010 0.010 ↑ 160.0 6 1

Seq Scan on entity_dimensions ed (cost=0.00..19.60 rows=960 width=12) (actual time=0.005..0.010 rows=6 loops=1)

92. 0.021 0.037 ↑ 6.2 16 1

Hash (cost=11.00..11.00 rows=100 width=4) (actual time=0.037..0.037 rows=16 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
93. 0.016 0.016 ↑ 6.2 16 1

Seq Scan on user_groups ug_1 (cost=0.00..11.00 rows=100 width=4) (actual time=0.004..0.016 rows=16 loops=1)

94. 0.072 0.119 ↑ 1.0 42 1

Hash (cost=1.42..1.42 rows=42 width=8) (actual time=0.119..0.119 rows=42 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
95. 0.047 0.047 ↑ 1.0 42 1

Seq Scan on lnk_user_user_groups luug_1 (cost=0.00..1.42 rows=42 width=8) (actual time=0.007..0.047 rows=42 loops=1)

96. 0.026 0.053 ↓ 2.6 23 1

Hash (cost=1.09..1.09 rows=9 width=41) (actual time=0.053..0.053 rows=23 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
97. 0.027 0.027 ↓ 2.6 23 1

Seq Scan on users u_1 (cost=0.00..1.09 rows=9 width=41) (actual time=0.010..0.027 rows=23 loops=1)

98. 0.004 0.015 ↑ 1.0 1 1

Hash (cost=13.50..13.50 rows=1 width=4) (actual time=0.015..0.015 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
99. 0.011 0.011 ↑ 1.0 1 1

Seq Scan on variable_types vt_1 (cost=0.00..13.50 rows=1 width=4) (actual time=0.009..0.011 rows=1 loops=1)

  • Filter: ((system_slug)::text = 'base'::text)
  • Rows Removed by Filter: 1
100. 126.890 126.890 ↑ 1.0 1 63,445

Index Scan using entity_variables_entity_id_variable_id_key on entity_variables ev_1 (cost=0.28..0.68 rows=1 width=12) (actual time=0.002..0.002 rows=1 loops=63,445)

  • Index Cond: ((entity_id = ed.entity_id) AND (variable_id = variables_3.id))
101. 190.272 190.272 ↑ 1.0 1 63,424

Index Scan using idx_entity_variable_entity_variable_dimensions on entity_variable_dimensions evd_1 (cost=0.28..0.36 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=63,424)

  • Index Cond: (entity_variable_id = ev_1.id)
  • Filter: default_responsibles
102.          

CTE entitiesUnitNotDefault

103. 0.026 10.870 ↓ 0.0 0 1

Hash Join (cost=210.41..243.35 rows=1 width=53) (actual time=10.870..10.870 rows=0 loops=1)

  • Hash Cond: (ev_2.variable_id = variables_4.id)
104. 0.018 0.147 ↓ 0.0 0 1

Hash Join (cost=105.35..137.15 rows=300 width=53) (actual time=0.146..0.147 rows=0 loops=1)

  • Hash Cond: (ev_2.entity_unit_id = eu.id)
105. 0.002 0.088 ↓ 0.0 0 1

Hash Left Join (cost=92.65..123.64 rows=300 width=49) (actual time=0.087..0.088 rows=0 loops=1)

  • Hash Cond: (COALESCE(evdr_1.user_id, luug_2.user_id) = u_2.id)
106. 0.008 0.086 ↓ 0.0 0 1

Hash Join (cost=91.44..121.62 rows=300 width=20) (actual time=0.085..0.086 rows=0 loops=1)

  • Hash Cond: (evd_2.entity_unit_variable_id = ev_2.id)
107. 0.002 0.061 ↓ 0.0 0 1

Hash Left Join (cost=55.34..84.74 rows=300 width=16) (actual time=0.060..0.061 rows=0 loops=1)

  • Hash Cond: (evdr_1.user_group_id = ug_2.id)
108. 0.011 0.059 ↓ 0.0 0 1

Hash Join (cost=40.31..67.08 rows=300 width=16) (actual time=0.058..0.059 rows=0 loops=1)

  • Hash Cond: (evdr_1.user_group_id = ugg_2.id)
109. 0.002 0.008 ↓ 0.0 0 1

Hash Join (cost=28.69..53.85 rows=600 width=16) (actual time=0.008..0.008 rows=0 loops=1)

  • Hash Cond: (evdr_1.entity_unit_variable_dimension_id = evd_2.id)
110. 0.006 0.006 ↓ 0.0 0 1

Seq Scan on entity_unit_variable_dimension_responsibles evdr_1 (cost=0.00..22.00 rows=1,200 width=12) (actual time=0.005..0.006 rows=0 loops=1)

111. 0.000 0.000 ↓ 0.0 0

Hash (cost=21.50..21.50 rows=575 width=12) (never executed)

112. 0.000 0.000 ↓ 0.0 0

Seq Scan on entity_unit_variable_dimensions evd_2 (cost=0.00..21.50 rows=575 width=12) (never executed)

  • Filter: (NOT default_responsibles)
113. 0.019 0.040 ↑ 3.3 15 1

Hash (cost=11.00..11.00 rows=50 width=4) (actual time=0.040..0.040 rows=15 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
114. 0.021 0.021 ↑ 3.3 15 1

Seq Scan on user_groups ugg_2 (cost=0.00..11.00 rows=50 width=4) (actual time=0.008..0.021 rows=15 loops=1)

  • Filter: active
  • Rows Removed by Filter: 1
115. 0.000 0.000 ↓ 0.0 0

Hash (cost=13.78..13.78 rows=100 width=8) (never executed)

116. 0.000 0.000 ↓ 0.0 0

Hash Right Join (cost=12.25..13.78 rows=100 width=8) (never executed)

  • Hash Cond: (luug_2.user_group_id = ug_2.id)
117. 0.000 0.000 ↓ 0.0 0

Seq Scan on lnk_user_user_groups luug_2 (cost=0.00..1.42 rows=42 width=8) (never executed)

118. 0.000 0.000 ↓ 0.0 0

Hash (cost=11.00..11.00 rows=100 width=4) (never executed)

119. 0.000 0.000 ↓ 0.0 0

Seq Scan on user_groups ug_2 (cost=0.00..11.00 rows=100 width=4) (never executed)

120. 0.006 0.017 ↑ 386.7 3 1

Hash (cost=21.60..21.60 rows=1,160 width=12) (actual time=0.016..0.017 rows=3 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 17kB
121. 0.011 0.011 ↑ 386.7 3 1

Seq Scan on entity_unit_variables ev_2 (cost=0.00..21.60 rows=1,160 width=12) (actual time=0.008..0.011 rows=3 loops=1)

122. 0.000 0.000 ↓ 0.0 0

Hash (cost=1.09..1.09 rows=9 width=41) (never executed)

123. 0.000 0.000 ↓ 0.0 0

Seq Scan on users u_2 (cost=0.00..1.09 rows=9 width=41) (never executed)

124. 0.014 0.041 ↑ 15.0 8 1

Hash (cost=11.20..11.20 rows=120 width=8) (actual time=0.040..0.041 rows=8 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
125. 0.027 0.027 ↑ 15.0 8 1

Seq Scan on entity_units eu (cost=0.00..11.20 rows=120 width=8) (actual time=0.020..0.027 rows=8 loops=1)

126. 2.627 10.697 ↓ 274.7 3,022 1

Hash (cost=104.93..104.93 rows=11 width=4) (actual time=10.696..10.697 rows=3,022 loops=1)

  • Buckets: 4096 (originally 1024) Batches: 1 (originally 1) Memory Usage: 139kB
127. 5.571 8.070 ↓ 274.7 3,022 1

Hash Join (cost=13.51..104.93 rows=11 width=4) (actual time=0.054..8.070 rows=3,022 loops=1)

  • Hash Cond: (variables_4.type_id = vt_2.id)
128. 2.481 2.481 ↑ 1.0 3,033 1

Seq Scan on variables variables_4 (cost=0.00..83.33 rows=3,033 width=8) (actual time=0.022..2.481 rows=3,033 loops=1)

129. 0.008 0.018 ↑ 1.0 1 1

Hash (cost=13.50..13.50 rows=1 width=4) (actual time=0.018..0.018 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
130. 0.010 0.010 ↑ 1.0 1 1

Seq Scan on variable_types vt_2 (cost=0.00..13.50 rows=1 width=4) (actual time=0.009..0.010 rows=1 loops=1)

  • Filter: ((system_slug)::text = 'base'::text)
  • Rows Removed by Filter: 1
131.          

CTE entitiesUnitDefault

132. 0.002 0.142 ↓ 0.0 0 1

Nested Loop (cost=208.01..313.57 rows=1 width=53) (actual time=0.141..0.142 rows=0 loops=1)

133. 0.002 0.140 ↓ 0.0 0 1

Nested Loop (cost=207.86..313.35 rows=1 width=57) (actual time=0.139..0.140 rows=0 loops=1)

134. 0.001 0.138 ↓ 0.0 0 1

Hash Join (cost=207.70..301.11 rows=55 width=57) (actual time=0.137..0.138 rows=0 loops=1)

  • Hash Cond: (variables_5.family_id = edf_1.family_id)
135. 0.009 0.028 ↑ 11.0 1 1

Hash Join (cost=13.51..104.93 rows=11 width=8) (actual time=0.027..0.028 rows=1 loops=1)

  • Hash Cond: (variables_5.type_id = vt_3.id)
136. 0.008 0.008 ↑ 3,033.0 1 1

Seq Scan on variables variables_5 (cost=0.00..83.33 rows=3,033 width=12) (actual time=0.008..0.008 rows=1 loops=1)

137. 0.001 0.011 ↑ 1.0 1 1

Hash (cost=13.50..13.50 rows=1 width=4) (actual time=0.011..0.011 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
138. 0.010 0.010 ↑ 1.0 1 1

Seq Scan on variable_types vt_3 (cost=0.00..13.50 rows=1 width=4) (actual time=0.009..0.010 rows=1 loops=1)

  • Filter: ((system_slug)::text = 'base'::text)
  • Rows Removed by Filter: 1
139. 0.001 0.109 ↓ 0.0 0 1

Hash (cost=181.44..181.44 rows=1,020 width=57) (actual time=0.108..0.109 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
140. 0.000 0.108 ↓ 0.0 0 1

Hash Left Join (cost=125.81..181.44 rows=1,020 width=57) (actual time=0.108..0.108 rows=0 loops=1)

  • Hash Cond: (COALESCE(ledfr_1.user_id, luug_3.user_id) = u_3.id)
141. 0.000 0.108 ↓ 0.0 0 1

Hash Join (cost=124.61..177.51 rows=1,020 width=28) (actual time=0.107..0.108 rows=0 loops=1)

  • Hash Cond: (ed_1.entity_unit_id = eu_1.id)
142. 0.059 0.107 ↓ 0.0 0 1

Hash Join (cost=111.91..162.07 rows=1,020 width=20) (actual time=0.106..0.107 rows=0 loops=1)

  • Hash Cond: (edf_1.entity_unit_dimension_id = ed_1.id)
143. 0.002 0.011 ↓ 0.0 0 1

Hash Join (cost=80.31..127.79 rows=1,020 width=16) (actual time=0.010..0.011 rows=0 loops=1)

  • Hash Cond: (ledfr_1.entity_unit_dimension_family_id = edf_1.id)
144. 0.002 0.009 ↓ 0.0 0 1

Hash Left Join (cost=26.66..71.45 rows=1,020 width=12) (actual time=0.008..0.009 rows=0 loops=1)

  • Hash Cond: (ledfr_1.user_group_id = ug_3.id)
145. 0.002 0.007 ↓ 0.0 0 1

Hash Join (cost=11.63..47.49 rows=1,020 width=12) (actual time=0.006..0.007 rows=0 loops=1)

  • Hash Cond: (ledfr_1.user_group_id = ugg_3.id)
146. 0.005 0.005 ↓ 0.0 0 1

Seq Scan on lnk_entity_unit_dimension_family_responsibles ledfr_1 (cost=0.00..30.40 rows=2,040 width=12) (actual time=0.005..0.005 rows=0 loops=1)

147. 0.000 0.000 ↓ 0.0 0

Hash (cost=11.00..11.00 rows=50 width=4) (never executed)

148. 0.000 0.000 ↓ 0.0 0

Seq Scan on user_groups ugg_3 (cost=0.00..11.00 rows=50 width=4) (never executed)

  • Filter: active
149. 0.000 0.000 ↓ 0.0 0

Hash (cost=13.78..13.78 rows=100 width=8) (never executed)

150. 0.000 0.000 ↓ 0.0 0

Hash Right Join (cost=12.25..13.78 rows=100 width=8) (never executed)

  • Hash Cond: (luug_3.user_group_id = ug_3.id)
151. 0.000 0.000 ↓ 0.0 0

Seq Scan on lnk_user_user_groups luug_3 (cost=0.00..1.42 rows=42 width=8) (never executed)

152. 0.000 0.000 ↓ 0.0 0

Hash (cost=11.00..11.00 rows=100 width=4) (never executed)

153. 0.000 0.000 ↓ 0.0 0

Seq Scan on user_groups ug_3 (cost=0.00..11.00 rows=100 width=4) (never executed)

154. 0.000 0.000 ↓ 0.0 0

Hash (cost=29.40..29.40 rows=1,940 width=12) (never executed)

155. 0.000 0.000 ↓ 0.0 0

Seq Scan on entity_unit_dimension_families edf_1 (cost=0.00..29.40 rows=1,940 width=12) (never executed)

156. 0.019 0.037 ↑ 80.0 12 1

Hash (cost=19.60..19.60 rows=960 width=12) (actual time=0.036..0.037 rows=12 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
157. 0.018 0.018 ↑ 80.0 12 1

Seq Scan on entity_unit_dimensions ed_1 (cost=0.00..19.60 rows=960 width=12) (actual time=0.008..0.018 rows=12 loops=1)

158. 0.000 0.001 ↑ 15.0 8 1

Hash (cost=11.20..11.20 rows=120 width=8) (actual time=0.000..0.001 rows=8 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
159. 0.001 0.001 ↑ 15.0 8 1

Seq Scan on entity_units eu_1 (cost=0.00..11.20 rows=120 width=8) (actual time=0.000..0.001 rows=8 loops=1)

160. 0.000 0.000 ↓ 0.0 0

Hash (cost=1.09..1.09 rows=9 width=41) (never executed)

161. 0.000 0.000 ↓ 0.0 0

Seq Scan on users u_3 (cost=0.00..1.09 rows=9 width=41) (never executed)

162. 0.000 0.000 ↓ 0.0 0

Index Scan using entity_unit_variables_entity_unit_id_variable_id_key on entity_unit_variables ev_3 (cost=0.15..0.22 rows=1 width=12) (never executed)

  • Index Cond: ((entity_unit_id = ed_1.entity_unit_id) AND (variable_id = variables_5.id))
163. 0.000 0.000 ↓ 0.0 0

Index Scan using entity_unit_variable_dimensi_entity_unit_variable_id_dime_key on entity_unit_variable_dimensions evd_3 (cost=0.15..0.22 rows=1 width=8) (never executed)

  • Index Cond: ((entity_unit_variable_id = ev_3.id) AND (dimension_id = ed_1.dimension_id))
  • Filter: default_responsibles
164. 10.592 857.134 ↓ 763.5 3,054 1

Sort (cost=0.30..0.31 rows=4 width=532) (actual time=854.742..857.134 rows=3,054 loops=1)

  • Sort Key: "entitiesNotDefault".entity_id, "entitiesNotDefault".entity_unit_id, "entitiesNotDefault".dimension_id, "entitiesNotDefault".variable_id
  • Sort Method: quicksort Memory: 526kB
165. 8.863 846.542 ↓ 763.5 3,054 1

HashAggregate (cost=0.18..0.22 rows=4 width=532) (actual time=843.436..846.542 rows=3,054 loops=1)

  • Group Key: "entitiesNotDefault".entity_id, "entitiesNotDefault".entity_unit_id, "entitiesNotDefault".dimension_id, "entitiesNotDefault".variable_id, "entitiesNotDefault".user_id
166. 4.529 837.679 ↓ 769.0 3,076 1

Append (cost=0.00..0.13 rows=4 width=532) (actual time=2.845..837.679 rows=3,076 loops=1)

167. 0.814 0.814 ↓ 0.0 0 1

CTE Scan on "entitiesNotDefault" (cost=0.00..0.02 rows=1 width=532) (actual time=0.813..0.814 rows=0 loops=1)

  • Filter: ((user_id)::text = '79f30646-d7b1-11e8-8dbb-f2801f1b9fd1'::text)
168. 821.318 821.318 ↓ 3,076.0 3,076 1

CTE Scan on "entitiesDefault" (cost=0.00..0.02 rows=1 width=532) (actual time=2.029..821.318 rows=3,076 loops=1)

  • Filter: ((user_id)::text = '79f30646-d7b1-11e8-8dbb-f2801f1b9fd1'::text)
  • Rows Removed by Filter: 3177
169. 10.873 10.873 ↓ 0.0 0 1

CTE Scan on "entitiesUnitNotDefault" (cost=0.00..0.02 rows=1 width=532) (actual time=10.873..10.873 rows=0 loops=1)

  • Filter: ((user_id)::text = '79f30646-d7b1-11e8-8dbb-f2801f1b9fd1'::text)
170. 0.145 0.145 ↓ 0.0 0 1

CTE Scan on "entitiesUnitDefault" (cost=0.00..0.02 rows=1 width=532) (actual time=0.144..0.145 rows=0 loops=1)

  • Filter: ((user_id)::text = '79f30646-d7b1-11e8-8dbb-f2801f1b9fd1'::text)
171. 0.014 0.094 ↑ 1.0 5 1

Hash (cost=1.05..1.05 rows=5 width=36) (actual time=0.093..0.094 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
172. 0.080 0.080 ↑ 1.0 5 1

Seq Scan on entities (cost=0.00..1.05 rows=5 width=36) (actual time=0.021..0.080 rows=5 loops=1)

173. 6.240 6.240 ↑ 1.0 1 3,120

Index Scan using variable_types_pkey on variable_types (cost=0.15..0.33 rows=1 width=36) (actual time=0.002..0.002 rows=1 loops=3,120)

  • Index Cond: (id = variables.type_id)
174. 6.240 6.240 ↑ 1.0 1 3,120

Index Scan using nature_pkey on natures nature (cost=0.15..0.33 rows=1 width=36) (actual time=0.002..0.002 rows=1 loops=3,120)

  • Index Cond: (id = variables.nature_id)
175. 6.240 6.240 ↑ 1.0 1 3,120

Index Scan using dimensions_pkey on dimensions (cost=0.14..0.19 rows=1 width=520) (actual time=0.002..0.002 rows=1 loops=3,120)

  • Index Cond: (id = entity_variable_dimensions.dimension_id)
176.          

SubPlan (forNested Loop)

177. 0.000 0.000 ↓ 0.0 0

Index Only Scan using "EntityUnit_pkey" on entity_units (cost=0.14..8.16 rows=1 width=32) (never executed)

  • Index Cond: (id = vp.entity_unit_id)
  • Heap Fetches: 0
Planning time : 24.053 ms