Re: Range Types: empty ranges

Поиск
Список
Период
Сортировка
От Nathan Boley
Тема Re: Range Types: empty ranges
Дата
Msg-id AANLkTi=7anH8b111-aGkdzEYiBf1MK_74Ly1r29GvVwd@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Range Types: empty ranges  (Jeff Davis <pgsql@j-davis.com>)
Список pgsql-hackers
FWIW, a very informal survey of probabilists didn't yield any reason
for trying to put an order on the empty set ( unless the metric was
cardinality or other equivalence relation ).

I think the problem here is that the idea of union and intersection
forming a ring over sets is being conflated with the order relation.
Clearly, combining the two notions can be inconsistent.  However...

>> >  A UNION (B INTERSECT C) = (A UNION B) INTERSECT (A UNION C)
>>
>> But the basic range type isn't even closed under UNION.
>
> An excellent point. Allow me to move the target a little:
>
>  WHERE A && B AND A && C
> and:
>  WHERE A && (B INTERSECT C)
>
> That seems like a logically sound transformation, but if (B INTERSECT C)
> is empty, it relies on the empty range for those two to be equivalent.
>
> Now, I agree that lack of closure on UNION exhibits many of the problems
> that I am pointing out related to forbidding empty ranges. However, I'm
> not sure if that means we should give up on either.

This seems potentially very useful, because we can transform WHERE A
&& B AND A && C from a bitmap scan into WHERE A && (B INTERSECT C), a
simple index scan. In the union case ( even if we had a type that
supported disjoint intervals), I doubt we would ever make that
transformation because the index will probably still be over connected
intervals.

So, +1 for keeping it how it is ( but maybe with a better error message ).

Best,
Nathan


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: psql patch: tab-complete :variables also at buffer start
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Debian readline/libedit breakage