You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FROM
(SELECT pgsa_history.srvid,
dense_rank() OVER (ORDER BY pgsa_history.ts) AS number,
count(*) OVER () AS total,
ts,
datid,
cur_txid,
backend_xid,
backend_xmin,
backend_start,
xact_start,
query_start,
state,
leader_pid
FROM (
SELECT *
FROM (
SELECT srvid, (unnest(records)).*
FROM public.powa_stat_activity_history pgsah
WHERE coalesce_range && tstzrange('2025-01-22 08:23:04+0100', '2025-01-22 09:23:04+0100', '[]')
AND pgsah.srvid = '1'
) AS unnested
WHERE ts <@ tstzrange('2025-01-22 08:23:04+0100', '2025-01-22 09:23:04+0100', '[]')
UNION ALL
SELECT srvid, (record).*
FROM public.powa_stat_activity_history_current pgsac
WHERE (pgsac.record).ts <@ tstzrange('2025-01-22 08:23:04+0100', '2025-01-22 09:23:04+0100', '[]')
AND pgsac.srvid = '1'
) AS pgsa_history
) AS pgsa
WHERE number % ( int8larger((total)/(100+1),1) ) = 0;
The problem is that "total" is not the amount of samples we want to return, it's the total count of records (and we have one record per active session in the snapshot. So If you have 100 sessions, total is off by a factor of 100 for the sampling, and you end up with 1 sample instead of 100
PR incoming
The text was updated successfully, but these errors were encountered:
It wrongly computes the sampling: the "total" column is not correct in
this context: we (most of the time) have more than 1 record per sample.
If you have 100 sessions, the sampling will be off by a factor of 100,
and you'll end up with only 1 sample
It's a bit ugly to fix, because we need another subquery...
Closes#254
It comes from this query:
The problem is that "total" is not the amount of samples we want to return, it's the total count of records (and we have one record per active session in the snapshot. So If you have 100 sessions, total is off by a factor of 100 for the sampling, and you end up with 1 sample instead of 100
PR incoming
The text was updated successfully, but these errors were encountered: