explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ado9

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

Hash Left Join (cost=11,308,753.08..11,704,380.27 rows=12 width=317) (actual rows= loops=)

  • Hash Cond: (l.establishment_id = e.id)
2. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=11,308,745.60..11,704,372.62 rows=12 width=294) (actual rows= loops=)

  • Merge Cond: (ls_1.sensor_id = h.sensor_id)
3. 0.000 0.000 ↓ 0.0

Sort (cost=11,308,745.17..11,308,745.20 rows=12 width=274) (actual rows= loops=)

  • Sort Key: ls_1.sensor_id
4. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=11,297,154.53..11,308,744.95 rows=12 width=274) (actual rows= loops=)

  • Merge Cond: (l.id = ls_1.line_id)
5. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=5,671,176.01..5,681,115.93 rows=12 width=254) (actual rows= loops=)

  • Merge Cond: (l.id = le.line_id)
6. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=5,629,398.37..5,639,280.94 rows=12 width=230) (actual rows= loops=)

  • Merge Cond: (l.id = ls.line_id)
7. 0.000 0.000 ↓ 0.0

Sort (cost=45.86..45.89 rows=12 width=162) (actual rows= loops=)

  • Sort Key: l.id
8. 0.000 0.000 ↓ 0.0

Seq Scan on lines l (cost=0.00..45.64 rows=12 width=162) (actual rows= loops=)

  • Filter: ((NOT archived) AND (establishment_id = 65) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 1 or hashed SubPlan 2)))
9.          

SubPlan (for Seq Scan)

10. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (l.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
11. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('lines#select'::text ~* (('^'::text || permission) || '$'::text))
12. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_1 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('lines#select'::text ~* (('^'::text || permission) || '$'::text))
13. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=5,629,352.51..5,639,230.19 rows=381 width=72) (actual rows= loops=)

  • Group Key: ls.line_id
14. 0.000 0.000 ↓ 0.0

Sort (cost=5,629,352.51..5,630,175.34 rows=329,129 width=44) (actual rows= loops=)

  • Sort Key: ls.line_id
15. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=57,998.60..5,589,065.15 rows=329,129 width=44) (actual rows= loops=)

  • Hash Cond: (p.sensor_id = ls.sensor_id)
  • Join Filter: (ls.connected @> p.poured_at)
16. 0.000 0.000 ↓ 0.0

Seq Scan on pours p (cost=0.00..5,526,918.68 rows=329,129 width=44) (actual rows= loops=)

  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 7 or hashed SubPlan 10))
17.          

SubPlan (for Seq Scan)

18. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.15..8.25 rows=1 width=0) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g (cost=0.14..8.21 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = p.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 5 or hashed SubPlan 6)))
20.          

SubPlan (for Index Scan)

21. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
22. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_4 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
23. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_5 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
24. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_6 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('pours#select'::text ~* (('^'::text || permission) || '$'::text))
25. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_1 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 8 or hashed SubPlan 9)))
27.          

SubPlan (for Seq Scan)

28. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_1.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
29. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_7 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
30. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_8 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
31. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_9 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('pours#select'::text ~* (('^'::text || permission) || '$'::text))
32. 0.000 0.000 ↓ 0.0

Hash (cost=57,993.20..57,993.20 rows=432 width=24) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Seq Scan on line_sensors ls (cost=0.00..57,993.20 rows=432 width=24) (actual rows= loops=)

  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 39 or hashed SubPlan 68))
34.          

SubPlan (for Seq Scan)

35. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.98..67.40 rows=1 width=0) (actual rows= loops=)

36. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.97..67.37 rows=1 width=0) (actual rows= loops=)

37. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.69..59.01 rows=1 width=0) (actual rows= loops=)

38. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.55..57.93 rows=1 width=4) (actual rows= loops=)

39. 0.000 0.000 ↓ 0.0

Index Scan using sensors_pkey on sensors s (cost=0.28..41.18 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = ls.sensor_id)
  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 21 or hashed SubPlan 30))
40.          

SubPlan (for Index Scan)

41. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..32.87 rows=1 width=0) (actual rows= loops=)

42. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..32.84 rows=1 width=0) (actual rows= loops=)

43. 0.000 0.000 ↓ 0.0

Index Scan using brus_pkey on brus b (cost=0.27..16.55 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = s.bru_id)
  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 15 or hashed SubPlan 18))
44.          

SubPlan (for Index Scan)

45. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.15..8.25 rows=1 width=0) (actual rows= loops=)

46. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_2 (cost=0.14..8.21 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = b.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 13 or hashed SubPlan 14)))
47.          

SubPlan (for Index Scan)

48. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_2.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
49. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_12 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
50. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_13 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
51. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_14 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
52. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

53. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_3 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 16 or hashed SubPlan 17)))
54.          

SubPlan (for Seq Scan)

55. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_3.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
56. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_15 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
57. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_16 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
58. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_17 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
59. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_4 (cost=0.14..8.21 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = b.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 19 or hashed SubPlan 20)))
60.          

SubPlan (for Index Scan)

61. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_4.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
62. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_18 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
63. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_19 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
64. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_20 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('sensors#select'::text ~* (('^'::text || permission) || '$'::text))
65. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..2,721.85 rows=2 width=4) (actual rows= loops=)

  • Join Filter: (g_7.id = b_1.gateway_id)
66. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

67. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_29 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('sensors#select'::text ~* (('^'::text || permission) || '$'::text))
68. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_7 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 28 or hashed SubPlan 29)))
69.          

SubPlan (for Seq Scan)

70. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_7.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
71. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_27 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
72. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_28 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
73. 0.000 0.000 ↓ 0.0

Seq Scan on brus b_1 (cost=0.00..2,700.67 rows=161 width=8) (actual rows= loops=)

  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 24 or hashed SubPlan 27))
74.          

SubPlan (for Seq Scan)

75. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.15..8.25 rows=1 width=0) (actual rows= loops=)

76. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_5 (cost=0.14..8.21 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = b_1.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 22 or hashed SubPlan 23)))
77.          

SubPlan (for Index Scan)

78. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_5.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
79. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_21 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
80. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_22 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
81. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_23 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
82. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

83. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_6 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 25 or hashed SubPlan 26)))
84.          

SubPlan (for Seq Scan)

85. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_6.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
86. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_24 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
87. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_25 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
88. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_26 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
89. 0.000 0.000 ↓ 0.0

Index Scan using brus_pkey on brus b_2 (cost=0.27..16.55 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = s.bru_id)
  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 33 or hashed SubPlan 36))
90.          

SubPlan (for Index Scan)

91. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.15..8.25 rows=1 width=0) (actual rows= loops=)

92. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_8 (cost=0.14..8.21 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = b_2.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 31 or hashed SubPlan 32)))
93.          

SubPlan (for Index Scan)

94. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_8.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
95. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_30 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
96. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_31 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
97. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_32 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
98. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

99. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_9 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 34 or hashed SubPlan 35)))
100.          

SubPlan (for Seq Scan)

101. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_9.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
102. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_33 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
103. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_34 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
104. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_35 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
105. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_10 (cost=0.14..0.61 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = b_2.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 37 or hashed SubPlan 38)))
106.          

SubPlan (for Index Scan)

107. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_10.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
108. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_36 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
109. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_37 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
110. 0.000 0.000 ↓ 0.0

Index Scan using lines_pkey on lines l_1 (cost=0.28..8.35 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = ls.line_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 11 or hashed SubPlan 12)))
111.          

SubPlan (for Index Scan)

112. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (l_1.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
113. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_10 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('lines#select'::text ~* (('^'::text || permission) || '$'::text))
114. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_11 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('lines#select'::text ~* (('^'::text || permission) || '$'::text))
115. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_38 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('line_sensors#select'::text ~* (('^'::text || permission) || '$'::text))
116. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..42,894.13 rows=46 width=8) (actual rows= loops=)

117. 0.000 0.000 ↓ 0.0

Seq Scan on lines l_2 (cost=0.00..50.68 rows=12 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 40 or hashed SubPlan 41)))
118.          

SubPlan (for Seq Scan)

119. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (l_2.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
120. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_39 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('lines#select'::text ~* (('^'::text || permission) || '$'::text))
121. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_40 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('lines#select'::text ~* (('^'::text || permission) || '$'::text))
122. 0.000 0.000 ↓ 0.0

Materialize (cost=0.01..42,842.86 rows=4 width=4) (actual rows= loops=)

123. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..42,842.84 rows=4 width=4) (actual rows= loops=)

  • Join Filter: (b_5.id = s_1.bru_id)
124. 0.000 0.000 ↓ 0.0

Seq Scan on sensors s_1 (cost=0.00..40,102.71 rows=609 width=8) (actual rows= loops=)

  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 50 or hashed SubPlan 59))
125.          

SubPlan (for Seq Scan)

126. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..32.87 rows=1 width=0) (actual rows= loops=)

127. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..32.84 rows=1 width=0) (actual rows= loops=)

128. 0.000 0.000 ↓ 0.0

Index Scan using brus_pkey on brus b_3 (cost=0.27..16.55 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = s_1.bru_id)
  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 44 or hashed SubPlan 47))
129.          

SubPlan (for Index Scan)

130. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.15..8.25 rows=1 width=0) (actual rows= loops=)

131. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_11 (cost=0.14..8.21 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = b_3.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 42 or hashed SubPlan 43)))
132.          

SubPlan (for Index Scan)

133. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_11.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
134. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_41 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
135. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_42 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
136. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_43 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
137. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

138. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_12 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 45 or hashed SubPlan 46)))
139.          

SubPlan (for Seq Scan)

140. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_12.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
141. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_44 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
142. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_45 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
143. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_46 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
144. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_13 (cost=0.14..8.21 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = b_3.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 48 or hashed SubPlan 49)))
145.          

SubPlan (for Index Scan)

146. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_13.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
147. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_47 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
148. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_48 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
149. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_49 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('sensors#select'::text ~* (('^'::text || permission) || '$'::text))
150. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..2,721.85 rows=2 width=4) (actual rows= loops=)

  • Join Filter: (g_16.id = b_4.gateway_id)
151. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

152. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_58 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('sensors#select'::text ~* (('^'::text || permission) || '$'::text))
153. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_16 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 57 or hashed SubPlan 58)))
154.          

SubPlan (for Seq Scan)

155. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_16.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
156. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_56 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
157. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_57 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
158. 0.000 0.000 ↓ 0.0

Seq Scan on brus b_4 (cost=0.00..2,700.67 rows=161 width=8) (actual rows= loops=)

  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 53 or hashed SubPlan 56))
159.          

SubPlan (for Seq Scan)

160. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.15..8.25 rows=1 width=0) (actual rows= loops=)

161. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_14 (cost=0.14..8.21 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = b_4.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 51 or hashed SubPlan 52)))
162.          

SubPlan (for Index Scan)

163. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_14.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
164. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_50 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
165. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_51 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
166. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_52 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
167. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

168. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_15 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 54 or hashed SubPlan 55)))
169.          

SubPlan (for Seq Scan)

170. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_15.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
171. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_53 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
172. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_54 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
173. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_55 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
174. 0.000 0.000 ↓ 0.0

Materialize (cost=0.01..2,721.86 rows=2 width=4) (actual rows= loops=)

175. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..2,721.85 rows=2 width=4) (actual rows= loops=)

  • Join Filter: (g_19.id = b_5.gateway_id)
176. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

177. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_67 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('line_sensors#select'::text ~* (('^'::text || permission) || '$'::text))
178. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_19 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 66 or hashed SubPlan 67)))
179.          

SubPlan (for Seq Scan)

180. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_19.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
181. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_65 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
182. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_66 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
183. 0.000 0.000 ↓ 0.0

Seq Scan on brus b_5 (cost=0.00..2,700.67 rows=161 width=8) (actual rows= loops=)

  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 62 or hashed SubPlan 65))
184.          

SubPlan (for Seq Scan)

185. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.15..8.25 rows=1 width=0) (actual rows= loops=)

186. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_17 (cost=0.14..8.21 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = b_5.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 60 or hashed SubPlan 61)))
187.          

SubPlan (for Index Scan)

188. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_17.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
189. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_59 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
190. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_60 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
191. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_61 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
192. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

193. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_18 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 63 or hashed SubPlan 64)))
194.          

SubPlan (for Seq Scan)

195. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_18.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
196. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_62 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
197. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_63 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
198. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_64 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
199. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=41,777.64..41,830.72 rows=334 width=28) (actual rows= loops=)

  • Group Key: le.line_id
200. 0.000 0.000 ↓ 0.0

Sort (cost=41,777.64..41,783.86 rows=2,487 width=16) (actual rows= loops=)

  • Sort Key: le.line_id
201. 0.000 0.000 ↓ 0.0

Seq Scan on line_events le (cost=0.00..41,637.38 rows=2,487 width=16) (actual rows= loops=)

  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 71 or hashed SubPlan 74))
202.          

SubPlan (for Seq Scan)

203. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.28..8.38 rows=1 width=0) (actual rows= loops=)

204. 0.000 0.000 ↓ 0.0

Index Scan using lines_pkey on lines l_3 (cost=0.28..8.35 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = le.line_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 69 or hashed SubPlan 70)))
205.          

SubPlan (for Index Scan)

206. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (l_3.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
207. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_68 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('lines#select'::text ~* (('^'::text || permission) || '$'::text))
208. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_69 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('lines#select'::text ~* (('^'::text || permission) || '$'::text))
209. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_70 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('line_events#select'::text ~* (('^'::text || permission) || '$'::text))
210. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..50.82 rows=12 width=4) (actual rows= loops=)

211. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_73 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('line_events#select'::text ~* (('^'::text || permission) || '$'::text))
212. 0.000 0.000 ↓ 0.0

Seq Scan on lines l_4 (cost=0.00..50.68 rows=12 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 72 or hashed SubPlan 73)))
213.          

SubPlan (for Seq Scan)

214. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (l_4.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
215. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_71 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('lines#select'::text ~* (('^'::text || permission) || '$'::text))
216. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_72 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('lines#select'::text ~* (('^'::text || permission) || '$'::text))
217. 0.000 0.000 ↓ 0.0

Unique (cost=5,625,978.51..5,627,624.16 rows=381 width=24) (actual rows= loops=)

218. 0.000 0.000 ↓ 0.0

Sort (cost=5,625,978.51..5,626,801.34 rows=329,129 width=24) (actual rows= loops=)

  • Sort Key: ls_1.line_id, p_1.poured_at DESC
219. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=57,998.60..5,589,065.15 rows=329,129 width=24) (actual rows= loops=)

  • Hash Cond: (p_1.sensor_id = ls_1.sensor_id)
  • Join Filter: (ls_1.connected @> p_1.poured_at)
220. 0.000 0.000 ↓ 0.0

Seq Scan on pours p_1 (cost=0.00..5,526,918.68 rows=329,129 width=20) (actual rows= loops=)

  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 77 or hashed SubPlan 80))
221.          

SubPlan (for Seq Scan)

222. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.15..8.25 rows=1 width=0) (actual rows= loops=)

223. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_20 (cost=0.14..8.21 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = p_1.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 75 or hashed SubPlan 76)))
224.          

SubPlan (for Index Scan)

225. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_20.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
226. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_74 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
227. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_75 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
228. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_76 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('pours#select'::text ~* (('^'::text || permission) || '$'::text))
229. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

230. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_21 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 78 or hashed SubPlan 79)))
231.          

SubPlan (for Seq Scan)

232. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_21.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
233. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_77 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
234. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_78 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
235. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_79 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('pours#select'::text ~* (('^'::text || permission) || '$'::text))
236. 0.000 0.000 ↓ 0.0

Hash (cost=57,993.20..57,993.20 rows=432 width=24) (actual rows= loops=)

237. 0.000 0.000 ↓ 0.0

Seq Scan on line_sensors ls_1 (cost=0.00..57,993.20 rows=432 width=24) (actual rows= loops=)

  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 109 or hashed SubPlan 138))
238.          

SubPlan (for Seq Scan)

239. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.98..67.40 rows=1 width=0) (actual rows= loops=)

240. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.97..67.37 rows=1 width=0) (actual rows= loops=)

241. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.69..59.01 rows=1 width=0) (actual rows= loops=)

242. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.55..57.93 rows=1 width=4) (actual rows= loops=)

243. 0.000 0.000 ↓ 0.0

Index Scan using sensors_pkey on sensors s_2 (cost=0.28..41.18 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = ls_1.sensor_id)
  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 91 or hashed SubPlan 100))
244.          

SubPlan (for Index Scan)

245. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..32.87 rows=1 width=0) (actual rows= loops=)

246. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..32.84 rows=1 width=0) (actual rows= loops=)

247. 0.000 0.000 ↓ 0.0

Index Scan using brus_pkey on brus b_6 (cost=0.27..16.55 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = s_2.bru_id)
  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 85 or hashed SubPlan 88))
248.          

SubPlan (for Index Scan)

249. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.15..8.25 rows=1 width=0) (actual rows= loops=)

250. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_22 (cost=0.14..8.21 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = b_6.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 83 or hashed SubPlan 84)))
251.          

SubPlan (for Index Scan)

252. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_22.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
253. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_82 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
254. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_83 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
255. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_84 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
256. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

257. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_23 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 86 or hashed SubPlan 87)))
258.          

SubPlan (for Seq Scan)

259. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_23.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
260. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_85 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
261. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_86 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
262. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_87 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
263. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_24 (cost=0.14..8.21 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = b_6.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 89 or hashed SubPlan 90)))
264.          

SubPlan (for Index Scan)

265. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_24.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
266. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_88 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
267. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_89 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
268. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_90 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('sensors#select'::text ~* (('^'::text || permission) || '$'::text))
269. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..2,721.85 rows=2 width=4) (actual rows= loops=)

  • Join Filter: (g_27.id = b_7.gateway_id)
270. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

271. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_99 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('sensors#select'::text ~* (('^'::text || permission) || '$'::text))
272. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_27 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 98 or hashed SubPlan 99)))
273.          

SubPlan (for Seq Scan)

274. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_27.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
275. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_97 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
276. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_98 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
277. 0.000 0.000 ↓ 0.0

Seq Scan on brus b_7 (cost=0.00..2,700.67 rows=161 width=8) (actual rows= loops=)

  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 94 or hashed SubPlan 97))
278.          

SubPlan (for Seq Scan)

279. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.15..8.25 rows=1 width=0) (actual rows= loops=)

280. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_25 (cost=0.14..8.21 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = b_7.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 92 or hashed SubPlan 93)))
281.          

SubPlan (for Index Scan)

282. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_25.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
283. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_91 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
284. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_92 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
285. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_93 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
286. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

287. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_26 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 95 or hashed SubPlan 96)))
288.          

SubPlan (for Seq Scan)

289. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_26.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
290. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_94 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
291. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_95 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
292. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_96 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
293. 0.000 0.000 ↓ 0.0

Index Scan using brus_pkey on brus b_8 (cost=0.27..16.55 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = s_2.bru_id)
  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 103 or hashed SubPlan 106))
294.          

SubPlan (for Index Scan)

295. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.15..8.25 rows=1 width=0) (actual rows= loops=)

296. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_28 (cost=0.14..8.21 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = b_8.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 101 or hashed SubPlan 102)))
297.          

SubPlan (for Index Scan)

298. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_28.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
299. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_100 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
300. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_101 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
301. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_102 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
302. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

303. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_29 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 104 or hashed SubPlan 105)))
304.          

SubPlan (for Seq Scan)

305. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_29.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
306. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_103 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
307. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_104 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
308. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_105 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
309. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_30 (cost=0.14..0.61 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = b_8.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 107 or hashed SubPlan 108)))
310.          

SubPlan (for Index Scan)

311. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_30.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
312. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_106 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
313. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_107 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
314. 0.000 0.000 ↓ 0.0

Index Scan using lines_pkey on lines l_5 (cost=0.28..8.35 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = ls_1.line_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 81 or hashed SubPlan 82)))
315.          

SubPlan (for Index Scan)

316. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (l_5.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
317. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_80 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('lines#select'::text ~* (('^'::text || permission) || '$'::text))
318. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_81 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('lines#select'::text ~* (('^'::text || permission) || '$'::text))
319. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_108 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('line_sensors#select'::text ~* (('^'::text || permission) || '$'::text))
320. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..42,894.13 rows=46 width=8) (actual rows= loops=)

321. 0.000 0.000 ↓ 0.0

Seq Scan on lines l_6 (cost=0.00..50.68 rows=12 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 110 or hashed SubPlan 111)))
322.          

SubPlan (for Seq Scan)

323. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (l_6.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
324. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_109 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('lines#select'::text ~* (('^'::text || permission) || '$'::text))
325. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_110 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('lines#select'::text ~* (('^'::text || permission) || '$'::text))
326. 0.000 0.000 ↓ 0.0

Materialize (cost=0.01..42,842.86 rows=4 width=4) (actual rows= loops=)

327. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..42,842.84 rows=4 width=4) (actual rows= loops=)

  • Join Filter: (b_11.id = s_3.bru_id)
328. 0.000 0.000 ↓ 0.0

Seq Scan on sensors s_3 (cost=0.00..40,102.71 rows=609 width=8) (actual rows= loops=)

  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 120 or hashed SubPlan 129))
329.          

SubPlan (for Seq Scan)

330. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..32.87 rows=1 width=0) (actual rows= loops=)

331. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..32.84 rows=1 width=0) (actual rows= loops=)

332. 0.000 0.000 ↓ 0.0

Index Scan using brus_pkey on brus b_9 (cost=0.27..16.55 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = s_3.bru_id)
  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 114 or hashed SubPlan 117))
333.          

SubPlan (for Index Scan)

334. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.15..8.25 rows=1 width=0) (actual rows= loops=)

335. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_31 (cost=0.14..8.21 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = b_9.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 112 or hashed SubPlan 113)))
336.          

SubPlan (for Index Scan)

337. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_31.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
338. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_111 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
339. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_112 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
340. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_113 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
341. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

342. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_32 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 115 or hashed SubPlan 116)))
343.          

SubPlan (for Seq Scan)

344. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_32.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
345. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_114 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
346. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_115 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
347. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_116 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
348. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_33 (cost=0.14..8.21 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = b_9.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 118 or hashed SubPlan 119)))
349.          

SubPlan (for Index Scan)

350. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_33.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
351. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_117 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
352. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_118 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
353. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_119 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('sensors#select'::text ~* (('^'::text || permission) || '$'::text))
354. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..2,721.85 rows=2 width=4) (actual rows= loops=)

  • Join Filter: (g_36.id = b_10.gateway_id)
355. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

356. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_128 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('sensors#select'::text ~* (('^'::text || permission) || '$'::text))
357. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_36 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 127 or hashed SubPlan 128)))
358.          

SubPlan (for Seq Scan)

359. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_36.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
360. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_126 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
361. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_127 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
362. 0.000 0.000 ↓ 0.0

Seq Scan on brus b_10 (cost=0.00..2,700.67 rows=161 width=8) (actual rows= loops=)

  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 123 or hashed SubPlan 126))
363.          

SubPlan (for Seq Scan)

364. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.15..8.25 rows=1 width=0) (actual rows= loops=)

365. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_34 (cost=0.14..8.21 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = b_10.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 121 or hashed SubPlan 122)))
366.          

SubPlan (for Index Scan)

367. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_34.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
368. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_120 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
369. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_121 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
370. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_122 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
371. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

372. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_35 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 124 or hashed SubPlan 125)))
373.          

SubPlan (for Seq Scan)

374. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_35.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
375. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_123 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
376. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_124 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
377. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_125 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
378. 0.000 0.000 ↓ 0.0

Materialize (cost=0.01..2,721.86 rows=2 width=4) (actual rows= loops=)

379. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..2,721.85 rows=2 width=4) (actual rows= loops=)

  • Join Filter: (g_39.id = b_11.gateway_id)
380. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

381. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_137 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('line_sensors#select'::text ~* (('^'::text || permission) || '$'::text))
382. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_39 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 136 or hashed SubPlan 137)))
383.          

SubPlan (for Seq Scan)

384. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_39.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
385. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_135 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
386. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_136 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
387. 0.000 0.000 ↓ 0.0

Seq Scan on brus b_11 (cost=0.00..2,700.67 rows=161 width=8) (actual rows= loops=)

  • Filter: (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 132 or hashed SubPlan 135))
388.          

SubPlan (for Seq Scan)

389. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.15..8.25 rows=1 width=0) (actual rows= loops=)

390. 0.000 0.000 ↓ 0.0

Index Scan using gateways_pkey on gateways g_37 (cost=0.14..8.21 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = b_11.gateway_id)
  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 130 or hashed SubPlan 131)))
391.          

SubPlan (for Index Scan)

392. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_37.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
393. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_129 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
394. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_130 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
395. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_131 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
396. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..19.17 rows=1 width=4) (actual rows= loops=)

397. 0.000 0.000 ↓ 0.0

Seq Scan on gateways g_38 (cost=0.00..19.13 rows=1 width=4) (actual rows= loops=)

  • Filter: ((establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 133 or hashed SubPlan 134)))
398.          

SubPlan (for Seq Scan)

399. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (g_38.establishment_id = (current_setting('bartrack.currentestablishment'::text))::integer)
400. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_132 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
401. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_133 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('gateways#select'::text ~* (('^'::text || permission) || '$'::text))
402. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_134 (cost=0.01..0.03 rows=1 width=0) (actual rows= loops=)

  • Filter: ('brus#select'::text ~* (('^'::text || permission) || '$'::text))
403. 0.000 0.000 ↓ 0.0

Unique (cost=0.43..395,620.91 rows=509 width=36) (actual rows= loops=)

404. 0.000 0.000 ↓ 0.0

Index Scan using heartbeats_sensor_receivedat on heartbeats h (cost=0.43..385,061.57 rows=4,223,738 width=36) (actual rows= loops=)

405. 0.000 0.000 ↓ 0.0

Hash (cost=7.47..7.47 rows=1 width=27) (actual rows= loops=)

406. 0.000 0.000 ↓ 0.0

Seq Scan on establishments e (cost=0.00..7.47 rows=1 width=27) (actual rows= loops=)

  • Filter: ((id = 65) AND (((current_setting('bartrack.currentroleuser'::text))::integer = 0) OR (alternatives: SubPlan 3 or hashed SubPlan 4)))
407.          

SubPlan (for Seq Scan)

408. 0.000 0.000 ↓ 0.0

Result (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • One-Time Filter: (e.id = (current_setting('bartrack.currentestablishment'::text))::integer)
409. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_2 (cost=0.02..0.04 rows=1 width=0) (actual rows= loops=)

  • Filter: ('establishments#select'::text ~* (('^'::text || permission) || '$'::text))
410. 0.000 0.000 ↓ 0.0

Function Scan on unnest _p_3 (cost=0.01..0.03 rows=1 width=4) (actual rows= loops=)

  • Filter: ('establishments#select'::text ~* (('^'::text || permission) || '$'::text))