pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Declarative Range Partitioning Postgres 11
Date: Tue, 8 Oct 2019 15:46:36 -0500
Message-ID: <eb0fb651-f95c-0bbe-e376-b216ce145b25@gmail.com> (raw)
In-Reply-To: <CAHOFxGqTFO8HRiF5Wng6gLZ6B4hMCEf_HupNmzx=v86yBkijNQ@mail.gmail.com>
References: <F2F23E564EB92A4C80228EB86713BA130BD969@TO1RODC.nbspaymentsolutions.com>
	<CAHOFxGpDfTH9JqsBirWXCBnGQjmUX-_BbdZi0nKod4HpdCmEEg@mail.gmail.com>
	<F2F23E564EB92A4C80228EB86713BA130BDA8E@TO1RODC.nbspaymentsolutions.com>
	<CAHOFxGqTFO8HRiF5Wng6gLZ6B4hMCEf_HupNmzx=v86yBkijNQ@mail.gmail.com>

On 10/8/19 12:33 PM, Michael Lewis wrote:
> On Tue, Oct 8, 2019 at 8:00 AM Shatamjeev Dewan <sdewan@nbsps.com 
> <mailto:sdewan@nbsps.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.

view thread (12+ messages)  latest in thread

Message-ID: <eb0fb651-f95c-0bbe-e376-b216ce145b25@gmail.com>
Permalink:  ../eb0fb651-f95c-0bbe-e376-b216ce145b25@gmail.com/
Also on:    postgresql.org/message-id/eb0fb651-f95c-0bbe-e376-b216ce145b25@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: Declarative Range Partitioning Postgres 11
  In-Reply-To: <eb0fb651-f95c-0bbe-e376-b216ce145b25@gmail.com>
  References: <F2F23E564EB92A4C80228EB86713BA130BD969@TO1RODC.nbspaymentsolutions.com> <CAHOFxGpDfTH9JqsBirWXCBnGQjmUX-_BbdZi0nKod4HpdCmEEg@mail.gmail.com> <F2F23E564EB92A4C80228EB86713BA130BDA8E@TO1RODC.nbspaymentsolutions.com> <CAHOFxGqTFO8HRiF5Wng6gLZ6B4hMCEf_HupNmzx=v86yBkijNQ@mail.gmail.com> <eb0fb651-f95c-0bbe-e376-b216ce145b25@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox