Decouple operator classes from index access methods

From: Emre Hasegeli <emre(at)hasegeli(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Decouple operator classes from index access methods
Date: 2021-06-22 16:52:23
Message-ID: CAE2gYzyKUPCp=OHdeRaiSAKXR7O67dfz1YfaUSYjfYZpphm5rw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I think we can benefit from higher level operator classes which can
support multiple index implementations. This is achievable by
introducing another type of access method. Here is my idea in SQL:

CREATE ACCESS METHOD ordering
TYPE INTERFACE HANDLER ordering_ifam_handler;

CREATE ACCESS METHOD btree
TYPE INDEX HANDLER bthandler
IMPLEMENTS (ordering);

CREATE OPERATOR CLASS btree_int_ops
FOR TYPE int USING ordering AS
FUNCTION 1 btint4cmp(int, int),
FUNCTION 3 =(int, int);

This can make it easier to develop both new index access methods and
data types. The extensions can provide them without depending on each
other.

The initial implementation is attached. I wrote it only to ask for
feedback. I am happy to work on the missing pieces if the community
supports the idea.

I suggest the initial version to come with 2 new access methods in the
new type: hashing and ordering. We can use those in the functions
that are currently searching for the hash and btree operator classes.

Later, I want to work on developing another access method for
containment. It can support high level operator classes with only SQL
callable functions. GiST, SP-GiST, and BRIN can implement this. We
can allow the new implementations together with the existing ones.

Attachment Content-Type Size
0001-v01-Implement-INTERFACE-access-method.patch application/octet-stream 86.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-06-22 17:05:52 Re: Decouple operator classes from index access methods
Previous Message Peter Geoghegan 2021-06-22 16:49:05 Re: Maintaining a list of pgindent commits for "git blame" to ignore