Re: Questions regarding Index AMs and natural ordering

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Questions regarding Index AMs and natural ordering
Дата
Msg-id 3338310.1700852306@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Questions regarding Index AMs and natural ordering  (Peter Geoghegan <pg@bowt.ie>)
Ответы Re: Questions regarding Index AMs and natural ordering  (Peter Geoghegan <pg@bowt.ie>)
Re: Questions regarding Index AMs and natural ordering  (Matthias van de Meent <boekewurm+postgres@gmail.com>)
Список pgsql-hackers
Peter Geoghegan <pg@bowt.ie> writes:
> On Fri, Nov 24, 2023 at 8:44 AM Matthias van de Meent
> <boekewurm+postgres@gmail.com> wrote:
>> Yes, the part where btree opclasses determine a type's ordering is
>> clear. But what I'm looking for is "how do I, as an index AM
>> implementation, get the signal that I need to return column-ordered
>> data?" If that signal is "index AM marked amcanorder == index must
>> return ordered data", then that's suboptimal for the index AM writer,
>> but understandable. If amcanorder does not imply always ordered
>> retrieval, then I'd like to know how it is signaled to the AM. But as
>> of yet I've not found a clear and conclusive answer either way.

> I suppose that amcanorder=true cannot mean that, since we have the
> SAOP path key thing (at least for now).

As things stand, amcanorder definitely means that the index always
returns ordered data, since the planner will unconditionally apply
pathkeys to the indexscan Paths generated for it (see plancat.c's
get_relation_info which sets up info->sortopfamily, and
build_index_pathkeys which uses that).  We could reconsider that
definition if there were a reason to, but so far it hasn't seemed
interesting.  The hack in 807a40c5 is a hack, without a doubt, but
that doesn't necessarily mean we should spend time on generalizing it,
and even less that we should have done so in 2012.  Maybe by now there
are non-core index AMs that have cases where it's worth being pickier.
We'd have to invent some API that allows the index AM to have a say in
what pathkeys get applied.

            regards, tom lane



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

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: Questions regarding Index AMs and natural ordering
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: mxid_age() and age(xid) appear undocumented