Re: partitioning question -- how to guarantee uniqueness across partitions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Whit Armstrong <armstrong(dot)whit(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: partitioning question -- how to guarantee uniqueness across partitions
Date: 2009-06-28 17:27:35
Message-ID: 10405.1246210055@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Whit Armstrong <armstrong(dot)whit(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Whit Armstrong 2009-06-28 18:45:04 Re: partitioning question -- how to guarantee uniqueness across partitions
Previous Message Justin 2009-06-28 17:17:55 Re: Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function