Re: Overlapping time ranges constraints in 8.4 - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Overlapping time ranges constraints in 8.4
Date
Msg-id CAHyXU0z5TFT6kMxwtmEWbTLX9rETjMqqqVJ5PxJEH1oWsnhvZg@mail.gmail.com
Whole thread Raw
In response to Re: Overlapping time ranges constraints in 8.4  ("EXT-Rothermel, Peter M" <Peter.M.Rothermel@boeing.com>)
List pgsql-general
On Mon, Aug 27, 2012 at 11:46 AM, EXT-Rothermel, Peter M
<Peter.M.Rothermel@boeing.com> wrote:
> I thought that this was going to be tricky.
>
> Perhaps I could use rules to populate a shadow table that is like a INNER JOIN of the two tables. This would
consolidatethe Boolean on the separate table into the same table that holds the time ranges. In version 8.4 I would
stillneed to use explicit locking on this shadow table but in 9.x an exclusion constraint may have a better chance of
working.

Are you expecting a lot of concurrent activity?  If not, your best bet
is probably to serialize all writes with an elevated lock.  Barring
that, you are probably going to have to write pending scheduling
activity into a queue and have a subsequent transaction consume the
queue and enforce the overlapping rules.

Also, it's worth giving a quick shout to the upcoming 9.2 (which is
going into release candidate status) range types feature for solving
these types of problems.

merlin


pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: FGS - Postgresql server install
Next
From: "Sahagian, David"
Date:
Subject: order of checking the unique constraints