Re: Declarative Range Partitioning Postgres 11

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Declarative Range Partitioning Postgres 11
Date: 2019-10-08 20:46:36
Message-ID: eb0fb651-f95c-0bbe-e376-b216ce145b25@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/8/19 12:33 PM, Michael Lewis wrote:
> On Tue, Oct 8, 2019 at 8:00 AM Shatamjeev Dewan <sdewan(at)nbsps(dot)com
> <mailto:sdewan(at)nbsps(dot)com>> wrote:
>
> Hi Michael,
>
> In this case , I always need to include partition key(date)  in
> primary key ( if I have a primary key defined on non partition key
> column e.g id (in my case), to make it a composite primary key (id,
> date). This would allow duplicate id with different date,which is not
> desirable .
>
>
> If you are generating the ID with a sequence, there isn't any real world
> likelihood of conflict, but I do understand your concern in terms of
> enforcing data integrity. Other than creating a custom stored procedure
> that functions as a primary key constraint, I don't know of any way around
> that.
>
> Let's take a step back... why do you think you need to partition at all?
> And why partition by the date/timestamp/timestamptz field?

Because archiving old is (well, /should be/) easier that way.

--
Angular momentum makes the world go 'round.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Igal Sapir 2019-10-08 22:51:52 Case Insensitive Comparison with Postgres 12
Previous Message Andreas Joseph Krogh 2019-10-08 18:40:13 Re: Segmentation fault with PG-12