Re: Reverse-sort indexes and NULLS FIRST/LAST sorting

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Reverse-sort indexes and NULLS FIRST/LAST sorting
Дата
Msg-id 3105.1167748654@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Reverse-sort indexes and NULLS FIRST/LAST sorting  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-hackers
Martijn van Oosterhout <kleptog@svana.org> writes:
> Issues which you havn't addressed are:

> - Pathkeys: How is the forward/reverse/nulls first/last going to be
> encoded in the pathkey?

I'm envisioning a struct with operator OID and null-ordering flag.
If we implement the explicit REVERSE variant then we'd have to be
prepared to match the OID against either the LessThan or GreaterThan
member of an index opclass depending --- it wouldn't add a third
field to pathkeys.

> But that leaves you with
> deciding whether to keep support for SORT_LT/GTFUNC?

I'm kind of inclined to drop the LTFUNC/GTFUNC business and insist that
every operator used as a sort operator must be a btree opclass member.
But that decision seems entirely orthogonal to the rest of it.

> - How do you deal with people asking for NULLS FIRST/LAST which is the
> opposite of how the index is defined. Say you can't use the index?

That's right, you can't.  Just like any other ordering incompatibility.

> One totally whacked out idea is to allowed the btree code to call the
> operator to decide nulls first/last, that would allow you to factor
> that part out at least.

This doesn't work at all unless you make all the operators non-strict,
which I hardly think we want.  Also, that path leads to needing FOUR
opclasses per datatype to support all the orderings :-(
        regards, tom lane


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

Предыдущее
От: "Neil Conway"
Дата:
Сообщение: Re: float8 width_bucket function
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Reverse-sort indexes and NULLS FIRST/LAST sorting