Proposal: Automatic partition creation

2020-07-06 Thread Anastasia Lubennikova
The previous discussion of automatic partition creation [1] has addressed static and dynamic creation of partitions and ended up with several syntax proposals. In this thread, I want to continue this work. Attached is PoC for static partition creation. The patch core is quite straightforward.

Re: Proposal: Automatic partition creation

2020-07-06 Thread Justin Pryzby
On Mon, Jul 06, 2020 at 01:45:52PM +0300, Anastasia Lubennikova wrote: > The previous discussion of automatic partition creation [1] has addressed > static and dynamic creation of partitions and ended up with several syntax > proposals. ... > where partition_auto_create_clause is > > CONFIGURATION

Re: Proposal: Automatic partition creation

2020-07-06 Thread Robert Haas
On Mon, Jul 6, 2020 at 6:46 AM Anastasia Lubennikova wrote: > CREATE TABLE ... PARTITION BY partition_method (list_of_columns) > partition_auto_create_clause > > where partition_auto_create_clause is > > CONFIGURATION [IMMEDIATE| DEFERRED] USING partition_bound_spec > > and partition_bound_spec is

Re: Proposal: Automatic partition creation

2020-07-06 Thread Tom Lane
Robert Haas writes: > On Mon, Jul 6, 2020 at 6:46 AM Anastasia Lubennikova > wrote: >> I am going to implement this via SPI, which allow to simplify checks and >> calculations. Do you see any pitfalls in this approach? > I don't really see why we need SPI here. I would vote against any core fac

Re: Proposal: Automatic partition creation

2020-07-07 Thread Robert Haas
On Mon, Jul 6, 2020 at 12:10 PM Tom Lane wrote: > We did indeed solve this in connection with window functions, cf > 0a459cec9. I may be misunderstanding what the problem is here, > but I think trying to reuse that infrastructure might help. Ah, nice. I didn't realize that we'd added that. But I

Re: Proposal: Automatic partition creation

2020-07-07 Thread Tom Lane
Robert Haas writes: > On Mon, Jul 6, 2020 at 12:10 PM Tom Lane wrote: >> We did indeed solve this in connection with window functions, cf >> 0a459cec9. I may be misunderstanding what the problem is here, >> but I think trying to reuse that infrastructure might help. > Ah, nice. I didn't realize

Re: Proposal: Automatic partition creation

2020-07-07 Thread Fabien COELHO
Hello Anastasia, My 0.02 €: The patch implements following syntax: CREATE TABLE ... PARTITION BY partition_method (list_of_columns) partition_auto_create_clause where partition_auto_create_clause is CONFIGURATION [IMMEDIATE| DEFERRED] USING partition_bound_spec and partition_bound_spec is:

Re: Proposal: Automatic partition creation

2020-07-07 Thread Amul Sul
On Wed, Jul 8, 2020 at 10:24 AM Fabien COELHO wrote: > > > Hello Anastasia, > > My 0.02 €: > > > The patch implements following syntax: > > > > CREATE TABLE ... PARTITION BY partition_method (list_of_columns) > > partition_auto_create_clause > > > > where partition_auto_create_clause is > > > > CO

Re: Proposal: Automatic partition creation

2020-07-13 Thread Anastasia Lubennikova
On 06.07.2020 19:10, Tom Lane wrote: Robert Haas writes: On Mon, Jul 6, 2020 at 6:46 AM Anastasia Lubennikova wrote: I am going to implement this via SPI, which allow to simplify checks and calculations. Do you see any pitfalls in this approach? I don't really see why we need SPI here. I wo

Re: Proposal: Automatic partition creation

2020-07-13 Thread Tom Lane
Anastasia Lubennikova writes: > On 06.07.2020 19:10, Tom Lane wrote: >> Robert Haas writes: >>> I think the big problem here is identifying the operator to use. We >>> have no way of identifying the "plus" or "minus" operator associated >>> with a datatype; indeed, that constant doesn't exist. >

Re: Proposal: Automatic partition creation

2020-07-13 Thread Anastasia Lubennikova
On 06.07.2020 13:45, Anastasia Lubennikova wrote: The previous discussion of automatic partition creation [1] has addressed static and dynamic creation of partitions and ended up with several syntax proposals. In this thread, I want to continue this work. ... [1] https://www.postgresql.org/me

Re: Proposal: Automatic partition creation

2020-07-13 Thread Anastasia Lubennikova
On 06.07.2020 17:59, Justin Pryzby wrote: I think you'd want to have an ALTER command for that (we would use that to change tables between daily/monthly based on their current size). That should also support setting the MODULUS of a HASH partitioned table, to allow changing the size of its parti