Re: Modest proposal to extend TableAM API for controlling cluster commands - Mailing list pgsql-hackers

From Mark Dilger
Subject Re: Modest proposal to extend TableAM API for controlling cluster commands
Date
Msg-id 4DD82EB9-E2D5-437A-AA6B-5CB28F129928@enterprisedb.com
Whole thread Raw
In response to Re: Modest proposal to extend TableAM API for controlling cluster commands  (Andres Freund <andres@anarazel.de>)
Responses Re: Modest proposal to extend TableAM API for controlling cluster commands
Re: Modest proposal to extend TableAM API for controlling cluster commands
List pgsql-hackers

> On Jun 15, 2022, at 7:14 PM, Andres Freund <andres@anarazel.de> wrote:
>
> Hi,
>
> On 2022-06-15 19:07:50 -0700, Mark Dilger wrote:
>>> On Jun 15, 2022, at 6:55 PM, Andres Freund <andres@anarazel.de> wrote:
>>>
>>> I think nothing would happen in this case - only pre-clustered tables get
>>> clustered in an argumentless CLUSTER. What am I missing?
>>
>> The "VACUUM FULL" synonym of "CLUSTER" doesn't depend on whether the target
>> is pre-clustered
>
> VACUUM FULL isn't a synonym of CLUSTER. While a good bit of the implementation
> is shared, VACUUM FULL doesn't order the table contents. I see now reason why
> an AM shouldn't support VACUUM FULL?

It's effectively a synonym which determines whether the "bool use_sort" parameter of the table AM's
relation_copy_for_clusterwill be set.  Heap-AM plays along and sorts or not based on that.  But it's up to the TAM what
itwants to do with that boolean, if in fact it does anything at all based on that.  A TAM could decide to do the exact
oppositeof what Heap-AM does and instead sort on VACUUM FULL but not sort on CLUSTER, or perhaps perform a randomized
shuffle,or <insert your weird behavior here>.  From the point-of-view of a TAM implementor, VACUUM FULL and CLUSTER are
synonyms. Or am I missing something? 

>> , and both will run against the table if the user has run an ALTER
>> TABLE..CLUSTER ON.
>
> If a user does that for a table that doesn't support clustering, well, I don't
> see what's gained by not erroring out.

Perhaps they want to give the TAM information about which index to use for sorting, on those occasions when the TAM's
logicdictates that sorting is appropriate, but not in response to a cluster command. 

—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company






pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Modest proposal to extend TableAM API for controlling cluster commands
Next
From: Mark Dilger
Date:
Subject: Re: Modest proposal to extend TableAM API for controlling cluster commands