Index skip-merge scan

From: Alexandre Felipe <o(dot)alexandre(dot)felipe(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Index skip-merge scan
Date: 2026-08-06 22:13:21
Message-ID: CAE8JnxOWESFVVaw-FjbPUmJJwnsEZPTHeSAEj_E8d9GFVMbJ0w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

This patch aims to support the execution of a specific query pattern
without requiring a sort (and potentially some temporary files).

I can quote Ants Aasma <ants(dot)aasma(at)cybertec(dot)at> [1]

> Think of the social media timeline, showing posts from
> all followed accounts in timestamp order, returned in reasonably sized
> batches.

I tried this before as an access method, and now I am going the easy way by
doing a plan transformation. Since skip-scan is implemented directly as a
feature of nbtree access method [2], my best shot was to use the same
approach and implement this feature as an access method [3].

I am glad the idea got some traction, but some questions related to how to
cost it properly can be hard, and to be honest, that patch was
uncomfortably large, this patch runs index scans through Merge Append,
which as pointed out in previous discussions [4], produces the same results.

Kind Regards,
Alexandre

---
[1]
https://www.postgresql.org/message-id/CANwKhkNd85u%2B4joaKR3YHoDOQSMg5SmJmsYJGo-tMyW%3DXVXTew%40mail.gmail.com

[2] https://github.com/postgres/postgres/commit/92fe23d93

[3]
https://www.postgresql.org/message-id/flat/AS1PR02MB784695AFEC37179FFAF7EAE19A9DA%40AS1PR02MB7846.eurprd02.prod.outlook.com

[4]
https://www.postgresql.org/message-id/CANwKhkNd85u%2B4joaKR3YHoDOQSMg5SmJmsYJGo-tMyW%3DXVXTew%40mail.gmail.com

Attachment Content-Type Size
v1-0001-SKIP-MERGE-Implementation.patch application/octet-stream 15.2 KB
v1-0002-SKIP-MERGE-tests.patch application/octet-stream 31.0 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2026-08-06 22:16:43 Re: [PATCH] vacuum: stop using stream ring after failsafe
Previous Message Tom Lane 2026-08-06 22:04:17 Re: [PATCH] vacuum: stop using stream ring after failsafe