Implementing CustomScan over an index

From: Chris Cleveland <ccleveland(at)dieselpoint(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Implementing CustomScan over an index
Date: 2024-05-30 04:02:30
Message-ID: CABSN6Ve2iTmTFSE37whcNPLbxNeJPJnYFFX5pFwxzEUpu15OLA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I've built a custom type of index. I implemented an index access method,
but have run into roadblocks. I need to:

1. See the other quals in the where clause.
2. Extract some things from the projection.
3. Insert some things in the projection.
4. Push some aggregations down into the index.

So I started implementing a CustomScan. It's not trivial.

I've learned that the system executes ExecInitCustomScan automatically, but
I probably need it to do most of the stuff in ExecInitIndexScan, and then
execute the scan mostly the way it's done in IndexNext.

Basically, I want just a normal index scan, but with the ability to do
custom things with the quals and the projection.

So... what's the best approach?

Is there any sample code that does this? A search of github doesn't turn up
much.

Is there any way to do this without duplicating everything in
nodeIndexscan.c myself?

--
Chris Cleveland
312-339-2677 mobile

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2024-05-30 04:02:58 Re: Avoid an odd undefined behavior with memcmp (src/bin/pg_rewind/pg_rewind.c)
Previous Message Peter Smith 2024-05-30 03:16:10 Re: Improving the latch handling between logical replication launcher and worker processes.