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

2022-06-16 Thread Mark Dilger
> On Jun 16, 2022, at 12:27 AM, Andres Freund wrote: > >> I don't think I should have to do so. It's like saying, "I think I should >> have freedom of speech", and you say, "well, I'm not sure about that; tell >> me what you want to say, and I'll decide if I'm going to let you say it".' >>

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

2022-06-16 Thread Mark Dilger
> On Jun 16, 2022, at 12:28 AM, David G. Johnston > wrote: > > But you are basically proposing a reworking of the existing system into one > that makes pretty much any SQL Command something that a TAM can treat as > being an optional request by the user; Yes, and I think I'm perfectly

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

2022-06-16 Thread David G. Johnston
On Wed, Jun 15, 2022 at 11:23 PM Mark Dilger wrote: > > > On Jun 15, 2022, at 8:50 PM, David G. Johnston < > david.g.johns...@gmail.com> wrote: > > > > On Wed, Jun 15, 2022 at 8:18 PM Andres Freund > wrote: > > > If a simple callback like > > > relation_supports_cluster(Relation rel) is too

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

2022-06-16 Thread Andres Freund
Hi, On 2022-06-15 22:23:36 -0700, Mark Dilger wrote: > I'm not entirely against you on that, but it makes me cringe that we impose > design decisions like that on any and all future TAMs. It seems better to > me to let the TAM author decide to emit an error, warning, notice, or > whatever, as

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

2022-06-16 Thread Mark Dilger
> On Jun 15, 2022, at 8:50 PM, David G. Johnston > wrote: > > On Wed, Jun 15, 2022 at 8:18 PM Andres Freund wrote: > > If a simple callback like > > relation_supports_cluster(Relation rel) is too simplistic > > Seems like it should be called: >

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

2022-06-15 Thread Mark Dilger
> On Jun 15, 2022, at 8:18 PM, Andres Freund wrote: > > Hi, > > On 2022-06-15 20:10:30 -0700, Mark Dilger wrote: >>> On Jun 15, 2022, at 7:30 PM, Andres Freund wrote: But it's up to the TAM what it wants to do with that boolean, if in fact it does anything at all based on that. A

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

2022-06-15 Thread David G. Johnston
On Wed, Jun 15, 2022 at 8:18 PM Andres Freund 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

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

2022-06-15 Thread Andres Freund
Hi, On 2022-06-15 20:10:30 -0700, Mark Dilger wrote: > > On Jun 15, 2022, at 7:30 PM, Andres Freund wrote: > >> But it's up to the TAM what it wants to do with that boolean, if in fact it > >> does anything at all based on that. A TAM could decide to do the exact > >> opposite of what Heap-AM

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

2022-06-15 Thread Mark Dilger
> On Jun 15, 2022, at 7:30 PM, Andres Freund wrote: > >> It's effectively a synonym which determines whether the "bool use_sort" >> parameter of the table AM's relation_copy_for_cluster will be set. Heap-AM >> plays along and sorts or not based on that. > > Hardly a synonym if it behaves

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

2022-06-15 Thread Andres Freund
Hi, On 2022-06-15 19:21:42 -0700, Mark Dilger wrote: > > On Jun 15, 2022, at 7:14 PM, Andres Freund wrote: > > On 2022-06-15 19:07:50 -0700, Mark Dilger wrote: > >>> On Jun 15, 2022, at 6:55 PM, Andres Freund wrote: > >>> > >>> I think nothing would happen in this case - only pre-clustered

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

2022-06-15 Thread Mark Dilger
> On Jun 15, 2022, at 7:21 PM, Mark Dilger wrote: > >> 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

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

2022-06-15 Thread Mark Dilger
> On Jun 15, 2022, at 7:14 PM, Andres Freund wrote: > > Hi, > > On 2022-06-15 19:07:50 -0700, Mark Dilger wrote: >>> On Jun 15, 2022, at 6:55 PM, Andres Freund wrote: >>> >>> I think nothing would happen in this case - only pre-clustered tables get >>> clustered in an argumentless CLUSTER.

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

2022-06-15 Thread Andres Freund
Hi, On 2022-06-15 19:07:50 -0700, Mark Dilger wrote: > > On Jun 15, 2022, at 6:55 PM, Andres Freund 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"

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

2022-06-15 Thread Mark Dilger
> On Jun 15, 2022, at 6:55 PM, Andres Freund 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, and both

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

2022-06-15 Thread Andres Freund
Hi, On 2022-06-15 18:24:45 -0700, Mark Dilger wrote: > > On Jun 15, 2022, at 6:01 PM, Andres Freund wrote: > > On 2022-06-15 17:21:56 -0700, Mark Dilger wrote: > >> While developing various Table Access Methods, I have wanted a callback for > >> determining if CLUSTER (and VACUUM FULL) should be

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

2022-06-15 Thread Mark Dilger
> On Jun 15, 2022, at 6:01 PM, Andres Freund wrote: > > Hi, > > On 2022-06-15 17:21:56 -0700, Mark Dilger wrote: >> While developing various Table Access Methods, I have wanted a callback for >> determining if CLUSTER (and VACUUM FULL) should be run against a table >> backed by a given TAM.

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

2022-06-15 Thread Andres Freund
Hi, On 2022-06-15 17:21:56 -0700, Mark Dilger wrote: > While developing various Table Access Methods, I have wanted a callback for > determining if CLUSTER (and VACUUM FULL) should be run against a table > backed by a given TAM. The current API contains a callback for doing the > guts of the

Modest proposal to extend TableAM API for controlling cluster commands

2022-06-15 Thread Mark Dilger
Hackers, While developing various Table Access Methods, I have wanted a callback for determining if CLUSTER (and VACUUM FULL) should be run against a table backed by a given TAM. The current API contains a callback for doing the guts of the cluster, but by that time, it's a bit too late to