On Tue, Mar 23, 2021 at 09:50:16AM +0300, Andrei Zubkov wrote:
>
> By the way right now in my workload tracing tool pg_profile I have to
> reset pg_stat_statements on every sample (wich is about 30-60 minutes)
> to make sure that all workload between samples is captured. This causes
> much more overhead. Introduced first_seen column can eliminate the need
> of resets.
Note that you could also detect entries for which some counters decreased (e.g.
the execution count), and in that case only use the current values. It should
give the exact same results as what you will get with the first_seen column,
except of course if some entry is almost never used and is suddenly used a lot
after an explicit reset or an eviction and only until you perform your
snapshot. I'm not sure that it's a very likely scenario though.
FTR that's how powa currently deals with reset/eviction.