Re: Resetting a single statistics counter

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Euler Taveira de Oliveira <euler(at)timbira(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Resetting a single statistics counter
Date: 2010-01-24 19:23:19
Message-ID: 9837222c1001241123m79390882uc289f38c6a8ea796@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2010/1/24 Euler Taveira de Oliveira <euler(at)timbira(dot)com>:
> Tom Lane escreveu:
>> That implies that the operations wouldn't work against system tables;
>> which they do.  I think a bigger problem is that "reset_single_table"
>> seems like it might be talking about something like a TRUNCATE, ie,
>> it's not clear that it means to reset counters rather than data.
>> The pg_stat_ prefix is some help but not enough IMO.  So I suggest
>> pg_stat_reset_table_counters and pg_stat_reset_function_counters.
>>
> Sure, much better. +1.
>
>> (BTW, a similar complaint could be made about the previously committed
>> patch: reset shared what?)
>>
> BTW, what about that idea to overload pg_stat_reset()? The
> pg_stat_reset_shared should be renamed to pg_stat_reset('foo') [1] where foo
> is the class of objects that it is resetting. pg_stat_reset is not a so
> suggestive name but that's one we already have; besides, it will be intuitive
> for users.

I think it's easier to use the way it is now. But yes, we could
overload it to make it:
pg_stat_reset() : everything, like now
pg_stat_reset('bgwriter') : what pg_stat_reset_shared() does
now. Can take more params.
pg_stat_reset('table', 'foo'::regclass); : what
pg_stat_reset_single_table_counters does now

The advantage would be fewer functions, but I still think it's easier
to use the way we have it now.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-01-24 19:30:30 Re: [BUG?] strange behavior in ALTER TABLE ... RENAME TO on inherited columns
Previous Message Robert Treat 2010-01-24 19:15:51 Re: 8.5 vs. 9.0, Postgres vs. PostgreSQL