News for hackers. Stuff that matters.
Re:PostgreSQL partitioning explained by drewcrawford on Sunday May 04, 2014 @02:20AM (#7693500)
I'm no database expert, but I don't think the features you want are possible, really. To get a unique constraint over multiple tables you'd have to lock them all, and if you lock them all you have lost the performance benefit of partitioning tables.

There are things you could do, like key on a GUID, that would ensure each insert has a unique ID in a lock-free way. But the semantics of that are going to be very different from a traditional autoincrementing ID.

Re:PostgreSQL partitioning explained by perlgeek on Sunday May 04, 2014 @07:06AM (#7693895)
Well, the locks would only be necessary for updates (or INSERTS where the constrained column doesn't come from the sequence), and that's a price I'd be willing to pay (hint, how often do you update the primary key column?)