@@ -71,11 +71,11 @@ def powa_base_statdata_detailed_db():
71
71
-- of the search interval, and has to be inside the coalesce_range. We
72
72
-- still need to unnest this one as we may have to remove some of the
73
73
-- underlying records
74
- SELECT unnested.dbid, unnested.userid, unnested.queryid,
74
+ SELECT unnested.dbid, unnested.toplevel, unnested. userid, unnested.queryid,
75
75
(unnested.records).*
76
76
FROM (
77
- SELECT psh.dbid, psh.userid , psh.queryid , psh.coalesce_range ,
78
- unnest(records) AS records
77
+ SELECT psh.dbid, psh.toplevel , psh.userid , psh.queryid ,
78
+ psh.coalesce_range, unnest(records) AS records
79
79
FROM powa_statements_history psh
80
80
WHERE coalesce_range && tstzrange(:from, :from, '[]')
81
81
AND psh.dbid = powa_databases.oid
@@ -95,11 +95,11 @@ def powa_base_statdata_detailed_db():
95
95
-- of the search interval, and has to be inside the coalesce_range. We
96
96
-- still need to unnest this one as we may have to remove some of the
97
97
-- underlying records
98
- SELECT unnested.dbid, unnested.userid, unnested.queryid,
98
+ SELECT unnested.dbid, unnested.toplevel, unnested. userid, unnested.queryid,
99
99
(unnested.records).*
100
100
FROM (
101
- SELECT psh.dbid, psh.userid , psh.queryid , psh.coalesce_range ,
102
- unnest(records) AS records
101
+ SELECT psh.dbid, psh.toplevel , psh.userid , psh.queryid ,
102
+ psh.coalesce_range, unnest(records) AS records
103
103
FROM powa_statements_history psh
104
104
WHERE coalesce_range && tstzrange(:to, :to, '[]')
105
105
AND psh.dbid = powa_databases.oid
@@ -119,10 +119,11 @@ def powa_base_statdata_detailed_db():
119
119
-- so we don't need to unnest them. We just retrieve the mins_in_range,
120
120
-- maxs_in_range from the record, build an array of this and return it as
121
121
-- if it was the full record
122
- SELECT unnested.dbid, unnested.userid, unnested.queryid,
122
+ SELECT unnested.dbid, unnested.toplevel, unnested. userid, unnested.queryid,
123
123
(unnested.records).*
124
124
FROM (
125
- SELECT psh.dbid, psh.userid, psh.queryid, psh.coalesce_range,
125
+ SELECT psh.dbid, psh.toplevel, psh.userid, psh.queryid,
126
+ psh.coalesce_range,
126
127
unnest(ARRAY[mins_in_range,maxs_in_range]) AS records
127
128
FROM powa_statements_history psh
128
129
WHERE coalesce_range && tstzrange(:from, :to, '[]')
@@ -140,7 +141,7 @@ def powa_base_statdata_detailed_db():
140
141
UNION ALL
141
142
142
143
-- The "current" records are simply returned after filtering
143
- SELECT psc.dbid, psc.userid, psc.queryid,(psc.record).*
144
+ SELECT psc.dbid, psc.toplevel, psc. userid, psc.queryid,(psc.record).*
144
145
FROM powa_statements_history_current psc
145
146
WHERE (record).ts <@ tstzrange(:from,:to,'[]')
146
147
AND psc.dbid = powa_databases.oid
@@ -311,13 +312,14 @@ def powa_getstatdata_detailed_db(srvid):
311
312
column ("srvid" ),
312
313
column ("queryid" ),
313
314
column ("dbid" ),
315
+ column ("toplevel" ),
314
316
column ("userid" ),
315
317
column ("datname" ),
316
318
] + diffs )
317
319
.select_from (base_query )
318
320
.where (column ("srvid" ) == srvid )
319
321
.group_by (column ("srvid" ), column ("queryid" ), column ("dbid" ),
320
- column ("userid" ), column ("datname" ))
322
+ column ("toplevel" ), column ( " userid" ), column ("datname" ))
321
323
.having (max (column ("calls" )) - min (column ("calls" )) > 0 ))
322
324
323
325
0 commit comments