Re: Remove nonmeaningful prefixes in PgStat_* fields

From: Andres Freund <andres(at)anarazel(dot)de>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Remove nonmeaningful prefixes in PgStat_* fields
Date: 2023-01-12 18:07:33
Message-ID: 20230112180733.agmvpugp6ggorade@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2023-01-12 18:12:52 +0100, Alvaro Herrera wrote:
> On 2023-Jan-12, Drouvot, Bertrand wrote:
>
> > Please find attached a patch to $SUBJECT.
> >
> > It is a preliminary patch for [1].
> >
> > The main ideas are: 1) to have consistent naming between the pg_stat_get*() functions
> > and their associated counters and 2) to define the new macros in [1] the same way as it
> > has been done in 8018ffbf58 (aka not using the prefixes in the macros).
>
> I don't like this at all. With these prefixes in place, it's much more
> likely that you'll be able to grep the whole source tree and not run
> into tons of false positives. If you remove them, that tends to be not
> very workable. If we use these commits as precedent for expanding this
> sort of renaming across the tree, we'll soon end up with a very
> grep-unfriendly code base.

The problem with that is that the prefixes are used completely inconsistently
- and have been for a long time. And not just between the different type of
stats. Compare e.g. PgStat_TableCounts with PgStat_TableXactStatus and
PgStat_StatTabEntry. Whereas PgStat_FunctionCounts and PgStat_StatFuncEntry
both use it. Right now there's no way to remember where to add the t_ prefix,
and where not.

Imo the reason to rename here isn't to abolish prefixes, it's to be halfway
consistent within closeby code. And the code overwhelmingly doesn't use the
prefixes.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2023-01-12 18:16:30 Re: Minimal logical decoding on standbys
Previous Message Vik Fearing 2023-01-12 17:45:09 Re: Named Operators