Re: Scalar in a range (but textual not numeric)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Scalar in a range (but textual not numeric)
Дата
Msg-id 6803.1077744728@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Scalar in a range (but textual not numeric)  (Richard Huxton <dev@archonet.com>)
Ответы Re: Scalar in a range (but textual not numeric)  (Richard Huxton <dev@archonet.com>)
Список pgsql-sql
Richard Huxton <dev@archonet.com> writes:
> Large table representing non-overlapping blocks:
> blocks(id int4, min varchar, max varchar)

> SELECT * FROM blocks WHERE 'ABCDE' BETWEEN min AND max;

> The estimator gets the wrong plan because it doesn't realise there's
> (at most) only one block that can match.

Even if it did realize that, it couldn't do much, because this query
isn't indexable as it stands.

I wonder whether you could adapt the "line segment" datatype
(see contrib/seg/) into a sort of "text segment" thingy and use the
GiST indexing support on that.  You'd have a query likeWHERE min_max_object overlaps-operator 'ABCDE'
and the overlaps operator would be a GiST-indexable one.
        regards, tom lane


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

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: Scalar in a range (but textual not numeric)
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Scalar in a range (but textual not numeric)