Re: Decouple operator classes from index access methods

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Emre Hasegeli <emre(at)hasegeli(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Decouple operator classes from index access methods
Date: 2021-06-25 20:42:39
Message-ID: CAPpHfdtd-v=qQQo9bHU_ZDvoD2J9n7xYKdxGyth3RHNQUqyZpQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 25, 2021 at 12:18 PM Emre Hasegeli <emre(at)hasegeli(dot)com> wrote:
> > In future we could have, for instance, LSM or in-memory B-tree or
> > other index AM, which could use existing B-tree or hash opclasses.
>
> This would be easily possible with my patch:
>
> CREATE ACCESS METHOD inmemorybtree
> TYPE INDEX HANDLER imbthandler
> IMPLEMENTS (ordering);
>
> > But even now, we could use this decoupling to get rid of ugly
> > btree_gist and btree_gin. And also solve the extensibility problem
> > here. If an extension provides datatype with B-tree opclass, we
> > currently can't directly use it with GiST and GIN. So, in order to
> > provide B-tree-like indexing for GiST and GIN, an extension needs to
> > explicitly define GiST and GIN B-tree-like opclasses.
>
> This would also be possible if we move btree_gist and btree_gin
> support functions inside gist and gin access methods. The access
> method support functions get the operator family. They can find which
> access method this operator family belongs to, and call the
> appropriate functions if it is "ordering".

Yes, that's it. That's quite an amount of work, but I think this
would be a great illustration of the advantages of this decoupling.

------
Regards,
Alexander Korotkov

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2021-06-25 20:58:46 Re: [PATCH] Make jsonapi usable from libpq
Previous Message Euler Taveira 2021-06-25 19:56:30 Re: Emit namespace in post-copy output