Re: pg_stat_reset_single_*_counters vs pg_stat_database.stats_reset

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Magnus Hagander <magnus(at)hagander(dot)net>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, Tomas Vondra <tv(at)fuzzy(dot)cz>
Subject: Re: pg_stat_reset_single_*_counters vs pg_stat_database.stats_reset
Date: 2022-03-30 01:04:43
Message-ID: CAKFQuwY2WAJocKevN9oR_aVKdiTtwZL5jk9JxqS4035BZJ+usQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 29, 2022 at 5:56 PM David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> On Tue, Mar 29, 2022 at 5:50 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
>
>> Hi,
>>
>> On 2022-03-29 17:06:24 -0700, David G. Johnston wrote:
>> > On Tue, Mar 29, 2022 at 4:43 PM Andres Freund <andres(at)anarazel(dot)de>
>> wrote:
>> > > But more importantly, a
>> > > per-relation/function reset field wouldn't address Tomas's concern: He
>> > > wants a
>> > > single thing to check to see if any stats have been reset - and
>> that's imo
>> > > a
>> > > quite reasonable desire.
>> > >
>> >
>> > Per the original email:
>> >
>> > "Starting with the below commit, pg_stat_reset_single_function_counters,
>> > pg_stat_reset_single_table_counters don't just reset the stats for the
>> > individual function, but also set pg_stat_database.stats_reset."
>> >
>> > Thus we already have the desired behavior, it is just poorly documented.
>>
>> The problem is that it also make stats_reset useless for other purposes -
>> which I do consider a problem. Hence this thread. My concern would be
>> mollified if I there were a separate reset timestamp counting the last
>> "database wide" reset time. Your comment about that was something about
>> relation/function level timestamps, which doesn't seem relevant.
>>
>
> I can't figure out whether you agree that as of today stats_reset is the
> "database wide" reset time. The first sentence makes it sound like you do,
> the first one makes it sound like you don't.
>

OK, I meant the third one seems contrary, but re-reading this all again I
think I see what you are saying.

You want to add a field that only changes when "reset all stats" is
executed for a given database. Leaving stats_reset to mean "the last time
any individual stat record changed". I can get behind that.

David J.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2022-03-30 01:06:17 Re: TRAP: FailedAssertion("HaveRegisteredOrActiveSnapshot()", File: "toast_internals.c", Line: 670, PID: 19403)
Previous Message David G. Johnston 2022-03-30 00:56:26 Re: pg_stat_reset_single_*_counters vs pg_stat_database.stats_reset