Re: Modest proposal to extend TableAM API for controlling cluster commands

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Modest proposal to extend TableAM API for controlling cluster commands
Date: 2022-06-16 03:50:31
Message-ID: CAKFQuwaMggG6iYRSx08SvXh=sd+8JrCuaYWhCDn7z8xWAGXEhw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 15, 2022 at 8:18 PM Andres Freund <andres(at)anarazel(dot)de> wrote:

> > If a simple callback like
> > relation_supports_cluster(Relation rel) is too simplistic
>

Seems like it should be called:
relation_supports_compaction[_by_removal_of_interspersed_dead_tuples]

Basically, if the user tells the table to make itself smaller on disk by
removing dead tuples, should we support the case where the Table AM says:
"Sorry, I cannot do that"?

If yes, then naming the table explicitly should elicit an error. Having
the table chosen implicitly should provoke a warning. For ALTER TABLE
CLUSTER there should be an error: which makes the implicit CLUSTER command
a non-factor.

However, given that should the table structure change it is imperative that
the Table AM be capable of producing a new physical relation with the
correct data, which will have been compacted as a side-effect, it seems
like, explicit or implicit, expecting any Table AM to do that when faced
with Vacuum Full is reasonable. Which leaves deciding how to allow a table
with a given TAM to prevent itself from being added to the CLUSTER roster.
And decide whether an opt-out feature for implicit VACUUM FULL is something
we should offer as well.

I'm doubtful that a TAM that is pluggable into the MVCC and WAL
architecture of PostgreSQL could avoid this basic contract between the
system and its users.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-06-16 03:51:03 Re: Extending USING [heap | mytam | yourtam] grammar and behavior
Previous Message Justin Pryzby 2022-06-16 03:50:14 Re: warn if GUC set to an invalid shared library