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

Поиск
Список
Период
Сортировка
От Mark Dilger
Тема Re: Modest proposal to extend TableAM API for controlling cluster commands
Дата
Msg-id 4DD82EB9-E2D5-437A-AA6B-5CB28F129928@enterprisedb.com
обсуждение исходный текст
Ответ на Re: Modest proposal to extend TableAM API for controlling cluster commands  (Andres Freund <andres@anarazel.de>)
Ответы Re: Modest proposal to extend TableAM API for controlling cluster commands  (Mark Dilger <mark.dilger@enterprisedb.com>)
Re: Modest proposal to extend TableAM API for controlling cluster commands  (Andres Freund <andres@anarazel.de>)
Список 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 по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Modest proposal to extend TableAM API for controlling cluster commands
Следующее
От: Mark Dilger
Дата:
Сообщение: Re: Modest proposal to extend TableAM API for controlling cluster commands