Re: Index with new opclass not used for sorting

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Index with new opclass not used for sorting
Дата
Msg-id 28343.1561124192@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Index with new opclass not used for sorting  (Ancoron Luciferis <ancoron.luciferis@googlemail.com>)
Ответы Re: Index with new opclass not used for sorting  (Ancoron Luciferis <ancoron.luciferis@googlemail.com>)
Список pgsql-general
Ancoron Luciferis <ancoron.luciferis@googlemail.com> writes:
> I am creating a new operator class for version 1 UUID's with an
> extension and thought I was almost done by implementing everything
> including SortSupport and creating a new opclass as follows:

> CREATE OPERATOR CLASS uuid_timestamp_ops FOR TYPE uuid
>     USING btree AS
>         OPERATOR        1       <*,
> ...

> ...but when sorting on an (unique) index column, I still get a separate
> sort, not using the index, e.g.:

You did not show your test query, but I imagine it just asked for the
type's ordinary sort order, which is not what this opclass is claiming
to provide.  To rely on the index's sort order you'd need something like

    select id from uuid_v1_ext
      where id <* '2b55fb04-33d8-11e9-9cfa-e03f494ffcf7'
      order by id using <* ;

If you want this opclass to become the default sort order for uuid
you'd have to remove the opcdefault marking from uuid_ops and attach
it to this opclass instead.  No, I'm not sure that that wouldn't have
unpleasant side-effects.

            regards, tom lane



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

Предыдущее
От: Espresso Beanies
Дата:
Сообщение: Re: Why does the pg_dumpall command have a database option?
Следующее
От: Ray O'Donnell
Дата:
Сообщение: Re: Why does the pg_dumpall command have a database option?