Re: unique index for periods

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: unique index for periods
Дата
Msg-id 15363.1250784595@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: unique index for periods  (Greg Stark <gsstark@mit.edu>)
Список pgsql-general
Greg Stark <gsstark@mit.edu> writes:
> On Thu, Aug 20, 2009 at 3:14 PM, Tom Lane<tgl@sss.pgh.pa.us> 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Temp table or normal table for performance?
Следующее
От: Christof König
Дата:
Сообщение: German ispell dictionary: error parsing affix file