Re: WIP: generalized index constraints - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: WIP: generalized index constraints
Date
Msg-id 1246900806.28986.79.camel@jdavis
Whole thread Raw
In response to Re: WIP: generalized index constraints  (Greg Stark <gsstark@mit.edu>)
Responses Re: WIP: generalized index constraints
List pgsql-hackers
On Mon, 2009-07-06 at 17:02 +0100, Greg Stark wrote:
> On Mon, Jul 6, 2009 at 4:57 PM, Jeff Davis<pgsql@j-davis.com> wrote:
> >
> > Exactly, you already know my use case ;) My goal is a "temporal key",
> > where you can't have overlapping intervals of time, e.g. the constraint
> > "nobody can be two places at the same time".
> 
> Incidentally to handle non-overlapping ranges you don't need GIST, you
> can actually use a plain btree. Since there are no overlapping ranges
> the ranges have a complete ordering and you can get that by just
> sorting by either endpoint. To enforce the constraint you only have to
> compare with the previous and following element in the btree.

What if you have an entire index full of overlapping dead tuples, and a
few live ones? How would search work?

Regards,Jeff Davis



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Show method of index
Next
From: Simon Riggs
Date:
Subject: Re: WIP: generalized index constraints