Search Postgresql Archives

Re: unique index for periods

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greg Stark <gsstark@xxxxxxx> writes:
> On Thu, Aug 20, 2009 at 3:14 PM, Tom Lane<tgl@xxxxxxxxxxxxx> wrote:
>> I don't believe it is possible to use a btree index for this purpose,
>> because there just isn't a way to express "overlaps" as a total order.

> That's true for the general case of indexing ranges but I don't think
> that's true for the case where overlaps are illegal.

Uh, no, the question is not about whether there are expected to be any
overlapping entries in the index.  The point is that "overlaps" simply
does not fit the semantic model of a btree-processable equality
relationship.

> In such a case
> you could just, sorting by the start point, compare the previous
> entry's end point with your start point and the next entry with your
> end point.

Even if you hacked the code to work like that, it'll fail completely for
deferred unique constraints, not to mention deleted entries that haven't
yet been purged from the index.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux