Re: Pgstattuple on Sequences: Seeking Community Feedback on Potential Patch

From: Ayush Vatsa <ayushvatsa1810(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, michael(at)paquier(dot)xyz
Subject: Re: Pgstattuple on Sequences: Seeking Community Feedback on Potential Patch
Date: 2024-08-26 18:09:35
Message-ID: CACX+KaPLdV_tPaWFHGrA7WCq6hJMN7usiR213aLPiZURwR6gFg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> You state that the
> information pgstattuple provides isn't really useful for sequences, so
> that means there's no real reason to do (1)
That's correct, but we should consider that up until v11,
sequences were supported in pgstattuple. Their support
was removed unintentionally (I believe so). Therefore, it might be worth
discussing whether it makes sense to reinstate support for sequences.

> why you think that the current one is bad
The current implementation has some drawbacks.
For instance, when encountering other unsupported objects, the error looks
like this:
ERROR: cannot get tuple-level statistics for relation "x"
DETAIL: This operation is not supported for foreign tables.

However, for sequences, the message should explicitly
state that "This operation is not supported for sequences."

Currently, we're deducing that the heap access method (AM) is
for relkind='r', so the message "only heap AM is supported" implies
that only relkind='r' are supported.
This prompted my thoughts on the matter.

Moreover, if you refer to the code in pgstattuple.c
<https://github.com/postgres/postgres/blob/master/contrib/pgstattuple/pgstattuple.c#L255-L256>
,
you'll notice that sequences appear to be explicitly allowed in
pgstattuple,
but it results in an error encountered here -
https://github.com/postgres/postgres/blob/master/contrib/pgstattuple/pgstattuple.c#L326-L329
Therefore, I believe a small refactoring is needed to make the code cleaner
and more consistent.

> IMHO it would be good to establish some level of consistency here.
Agree.

Let me know your thoughts.

Regards
Ayush Vatsa
AWS

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2024-08-26 18:14:28 Re: Pgstattuple on Sequences: Seeking Community Feedback on Potential Patch
Previous Message Andrei Lepikhov 2024-08-26 18:00:54 Re: allowing extensions to control planner behavior