Hi Julien, On Tue, 2021-03-23 at 15:03 +0800, Julien Rouhaud wrote: > 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.
Yes, but checking condition for several counters seems complicated compared to check only one field. > 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. But it is possible, and we are guessing here. Storing a timestamp does not seems too expensive to me, but it totally eliminates guessing, and provides a clear view about the time interval we watching for this specific statement. > FTR that's how powa currently deals with reset/eviction. PoWA sampling is much more frequent than pg_profile. For PoWA it is, of cource, very unlikely scenario, but still possible. -- Andrei Zubkov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company
