Re: partitioning question -- how to guarantee uniqueness across partitions - Mailing list pgsql-general

From Tom Lane
Subject Re: partitioning question -- how to guarantee uniqueness across partitions
Date
Msg-id 10405.1246210055@sss.pgh.pa.us
Whole thread Raw
In response to partitioning question -- how to guarantee uniqueness across partitions  (Whit Armstrong <armstrong.whit@gmail.com>)
Responses Re: partitioning question -- how to guarantee uniqueness across partitions
List pgsql-general
Whit Armstrong <armstrong.whit@gmail.com> writes:
> I have a simple example copied from the 8.3 manual on partitioning
> (http://www.postgresql.org/docs/8.3/interactive/ddl-partitioning.html).

> My question is, if you create a serial type in the parent table which
> is meant to be the primary key across all the partitions, how does one
> guarantee uniqueness of that key?

One doesn't.  That is not an appropriate way to set up a partitioned
table.  You need a primary key that can actually be used as a meaningful
partitioning key.  In this example, the id is completely useless and
what you should be looking at is making the data_value be the primary
key.

            regards, tom lane

pgsql-general by date:

Previous
From: Justin
Date:
Subject: Re: Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function
Next
From: Whit Armstrong
Date:
Subject: Re: partitioning question -- how to guarantee uniqueness across partitions