Re: [HACKERS] Partitioning WIP patch

2015-03-03 Thread Bruce Momjian
On Fri, Feb 27, 2015 at 09:09:35AM +0900, Amit Langote wrote: > On 27-02-2015 AM 03:24, Andres Freund wrote: > > On 2015-02-26 12:15:17 +0900, Amit Langote wrote: > >> On 26-02-2015 AM 05:15, Josh Berkus wrote: > >>> I would love to have it for 9.5, but I guess the > >>> patch isn't nearly baked en

Re: [HACKERS] Partitioning WIP patch

2015-02-26 Thread Amit Langote
On 27-02-2015 AM 03:01, Jim Nasby wrote: > On 2/26/15 3:09 AM, Amit Langote wrote: >> Unless I'm missing something again, isn't allowing partitions to have >> heterogeneous rowtypes a problem in the long run? I'm afraid I'm >> confused as to your stand regarding inheritance vs. new partitioning. To

Re: [HACKERS] Partitioning WIP patch

2015-02-26 Thread Michael Paquier
On Fri, Feb 27, 2015 at 3:24 AM, Andres Freund wrote: > On 2015-02-26 12:15:17 +0900, Amit Langote wrote: >> On 26-02-2015 AM 05:15, Josh Berkus wrote: >> > On 02/24/2015 12:13 AM, Amit Langote wrote: >> >> Here is an experimental patch that attempts to implement this. > >> > I would love to have

Re: [HACKERS] Partitioning WIP patch

2015-02-26 Thread Amit Langote
On 27-02-2015 AM 03:18, Josh Berkus wrote: > On 02/25/2015 07:15 PM, Amit Langote wrote: >> I'm not quite sure what would qualify as baked enough for 9.5 though we >> can surely try to reach some consensus on various implementation aspects >> and perhaps even get it ready in time for 9.5. > > Well

Re: [HACKERS] Partitioning WIP patch

2015-02-26 Thread Amit Langote
On 27-02-2015 AM 03:24, Andres Freund wrote: > On 2015-02-26 12:15:17 +0900, Amit Langote wrote: >> On 26-02-2015 AM 05:15, Josh Berkus wrote: >>> I would love to have it for 9.5, but I guess the >>> patch isn't nearly baked enough for that? > >> I'm not quite sure what would qualify as baked enou

Re: [HACKERS] Partitioning WIP patch

2015-02-26 Thread Andres Freund
On 2015-02-26 12:15:17 +0900, Amit Langote wrote: > On 26-02-2015 AM 05:15, Josh Berkus wrote: > > On 02/24/2015 12:13 AM, Amit Langote wrote: > >> Here is an experimental patch that attempts to implement this. > > I would love to have it for 9.5, but I guess the > > patch isn't nearly baked enoug

Re: [HACKERS] Partitioning WIP patch

2015-02-26 Thread Josh Berkus
On 02/25/2015 07:15 PM, Amit Langote wrote: > On 26-02-2015 AM 05:15, Josh Berkus wrote: >> On 02/24/2015 12:13 AM, Amit Langote wrote: >>> Here is an experimental patch that attempts to implement this. >> >> This looks awesome. > > Thanks! > >> I would love to have it for 9.5, but I guess the >

Re: [HACKERS] Partitioning WIP patch

2015-02-26 Thread Jim Nasby
On 2/26/15 3:22 AM, Andres Freund wrote: On 2015-02-26 02:20:21 -0600, Jim Nasby wrote: The reason I'd like to do this with partitioning vs plain inheritance is presumably as we build out partitioning we'll get very useful things like the ability to have FKs to properly partitioned tables. Inser

Re: [HACKERS] Partitioning WIP patch

2015-02-26 Thread Jim Nasby
On 2/26/15 3:09 AM, Amit Langote wrote: Yes. If it helps, the exact use-case I have in mind is using list-based >partitioning + additional columns in some/all children (different >between children). For example, if you need to track different types of >customer payment methods, you'd have a payme

Re: [HACKERS] Partitioning WIP patch

2015-02-26 Thread Andres Freund
On 2015-02-26 02:20:21 -0600, Jim Nasby wrote: > The reason I'd like to do this with partitioning vs plain inheritance is > presumably as we build out partitioning we'll get very useful things like > the ability to have FKs to properly partitioned tables. Insert tuple routing > could also be useful

Re: [HACKERS] Partitioning WIP patch

2015-02-26 Thread Amit Langote
On 26-02-2015 PM 05:20, Jim Nasby wrote: > On 2/25/15 7:57 PM, Amit Langote wrote: >> AIUI, as far as we stay with a design where partitions (children) are >> individually planned, that might be OK. But, I guess things will get >> more complicated. I think the role of a parent in planning would rem

Re: [HACKERS] Partitioning WIP patch

2015-02-26 Thread Jim Nasby
On 2/25/15 7:57 PM, Amit Langote wrote: On 26-02-2015 AM 10:31, Jim Nasby wrote: On 2/25/15 7:24 PM, Amit Langote wrote: Does ALTER TABLE parent_monthly_x_201401 ADD COLUMN foo still operate the same as today? I'd like to see us continue to support that, but perhaps it would be wise to not

Re: [HACKERS] Partitioning WIP patch

2015-02-25 Thread Amit Langote
On 26-02-2015 AM 05:15, Josh Berkus wrote: > On 02/24/2015 12:13 AM, Amit Langote wrote: >> Here is an experimental patch that attempts to implement this. > > This looks awesome. Thanks! > I would love to have it for 9.5, but I guess the > patch isn't nearly baked enough for that? > I'm not q

Re: [HACKERS] Partitioning WIP patch

2015-02-25 Thread Amit Langote
On 26-02-2015 AM 10:31, Jim Nasby wrote: > On 2/25/15 7:24 PM, Amit Langote wrote: >>> >Does ALTER TABLE parent_monthly_x_201401 ADD COLUMN foo still >>> >operate the same as today? I'd like to see us continue to support that, >>> >but perhaps it would be wise to not paint ourselves into that c

Re: [HACKERS] Partitioning WIP patch

2015-02-25 Thread Jim Nasby
On 2/25/15 7:24 PM, Amit Langote wrote: >Does ALTER TABLE parent_monthly_x_201401 ADD COLUMN foo still >operate the same as today? I'd like to see us continue to support that, >but perhaps it would be wise to not paint ourselves into that corner >just yet. Nothing prevents that from working,

Re: [HACKERS] Partitioning WIP patch

2015-02-25 Thread Amit Langote
On 26-02-2015 AM 10:24, Amit Langote wrote: > To clarify things a bit more, transformCreateStmt() transforms PARTITION > OF into LIKE INCLUDING ALL, not INHERITS. And as mentioned, for Append > to work, I have made ATExecAddInherit() to do some of the things > ATExecAttachPartition() does. Again, t

Re: [HACKERS] Partitioning WIP patch

2015-02-25 Thread Amit Langote
On 26-02-2015 AM 09:28, Jim Nasby wrote: > On 2/24/15 2:13 AM, Amit Langote wrote: >> -- a plain table >> CREATE TABLE parent_monthly(year int, month int, day int); >> >> -- a partitioned table >> -- x: number of partitions >> CREATE TABLE parent_monthly_x(LIKE parent_monthly) PARTITION BY

Re: [HACKERS] Partitioning WIP patch (was: Partitioning: issues/ideas)

2015-02-25 Thread Jim Nasby
On 2/24/15 2:13 AM, Amit Langote wrote: -- a plain table CREATE TABLE parent_monthly(year int, month int, day int); -- a partitioned table -- x: number of partitions CREATE TABLE parent_monthly_x(LIKE parent_monthly) PARTITION BY RANGE ON(year, month); To be clear, in this example pare

Re: [HACKERS] Partitioning WIP patch

2015-02-25 Thread Josh Berkus
On 02/24/2015 12:13 AM, Amit Langote wrote: > Here is an experimental patch that attempts to implement this. This looks awesome. I would love to have it for 9.5, but I guess the patch isn't nearly baked enough for that? > It implements the following syntax: > > * Syntax for defining partition k

Re: [HACKERS] Partitioning WIP patch (was: Partitioning: issues/ideas)

2015-02-25 Thread Amit Langote
On 24-02-2015 PM 05:13, Amit Langote wrote: > On 21-01-2015 PM 07:26, Amit Langote wrote: >> >> Ok, I will limit myself to focusing on following things at the moment: >> >> * Provide syntax in CREATE TABLE to declare partition key >> * Provide syntax in CREATE TABLE to declare a table as partition

Re: [HACKERS] Partitioning WIP patch (was: Partitioning: issues/ideas)

2015-02-24 Thread Amit Langote
On 25-02-2015 AM 01:13, Corey Huinker wrote: > I think it's confusing to use BETWEEN to mean [low,high) when it already > means [low,high] in WHERE clauses. > Yeah, I'm not really attached to that syntax. > Why not leverage range notation instead? > > CREATE TABLE parent_monthly_x_201401 PA

Re: [HACKERS] Partitioning WIP patch (was: Partitioning: issues/ideas)

2015-02-24 Thread Corey Huinker
I think it's confusing to use BETWEEN to mean [low,high) when it already means [low,high] in WHERE clauses. Why not leverage range notation instead? CREATE TABLE parent_monthly_x_201401 PARTITION OF parent_monthly_x FOR VALUES IN RANGE '[2014-04-01,2014-05-01)' "IN RANGE" could easily be

Re: [HACKERS] Partitioning WIP patch (was: Partitioning: issues/ideas)

2015-02-24 Thread Amit Langote
On 24-02-2015 PM 05:13, Amit Langote wrote: > Additionally, a partition can itself be further partitioned (though I > have not worked on the implementation details of multilevel partitioning > yet): > > CREATE TABLE table_name PARTITION OF parent_name PARTITION BY > {RANGE|LIST} ON(key_columns) FO

Re: [HACKERS] Partitioning WIP patch (was: Partitioning: issues/ideas)

2015-02-24 Thread Amit Langote
On 24-02-2015 PM 05:13, Amit Langote wrote: > -- partitions > CREATE TABLE parent_monthly_x_201401 PARTITION OF > parent_monthly_00100_201401 FOR VALUES BETWEEN (2014, 1) AND (2014, 2); > > CREATE TABLE parent_monthly_x_201402 PARTITION OF > parent_monthly_00100_201402 FOR VALUES BETWEEN (

[HACKERS] Partitioning WIP patch (was: Partitioning: issues/ideas)

2015-02-24 Thread Amit Langote
On 21-01-2015 PM 07:26, Amit Langote wrote: > > Ok, I will limit myself to focusing on following things at the moment: > > * Provide syntax in CREATE TABLE to declare partition key > * Provide syntax in CREATE TABLE to declare a table as partition of a > partitioned table and values it contains > *