Index skip-merge scan

Started by Alexandre Felipe4 months ago1 messageshackers

Thread notes

1 note#performance#moderate
hackorum-bot#performance#moderate
hackorum-bot
2 days ago

@global #performance #moderate

#performance#moderate
Jump to latest
#1Alexandre Felipe
o.alexandre.felipe@gmail.com

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]/messages/by-id/CANwKhkNd85u+4joaKR3YHoDOQSMg5SmJmsYJGo-tMyW=XVXTew@mail.gmail.com

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]https://github.com/postgres/postgres/commit/92fe23d93, my best shot was to use the same
approach and implement this feature as an access method [3]/messages/by-id/AS1PR02MB784695AFEC37179FFAF7EAE19A9DA@AS1PR02MB7846.eurprd02.prod.outlook.com.

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]/messages/by-id/CANwKhkNd85u+4joaKR3YHoDOQSMg5SmJmsYJGo-tMyW=XVXTew@mail.gmail.com, produces the same results.

Kind Regards,
Alexandre

---
[1]: /messages/by-id/CANwKhkNd85u+4joaKR3YHoDOQSMg5SmJmsYJGo-tMyW=XVXTew@mail.gmail.com
/messages/by-id/CANwKhkNd85u+4joaKR3YHoDOQSMg5SmJmsYJGo-tMyW=XVXTew@mail.gmail.com

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

[3]: /messages/by-id/AS1PR02MB784695AFEC37179FFAF7EAE19A9DA@AS1PR02MB7846.eurprd02.prod.outlook.com
/messages/by-id/AS1PR02MB784695AFEC37179FFAF7EAE19A9DA@AS1PR02MB7846.eurprd02.prod.outlook.com

[4]: /messages/by-id/CANwKhkNd85u+4joaKR3YHoDOQSMg5SmJmsYJGo-tMyW=XVXTew@mail.gmail.com
/messages/by-id/CANwKhkNd85u+4joaKR3YHoDOQSMg5SmJmsYJGo-tMyW=XVXTew@mail.gmail.com

Attachments:

t253339_1
v1-0001-SKIP-MERGE-Implementation.patchapplication/octet-stream; name=v1-0001-SKIP-MERGE-Implementation.patchDownload+353-3
v1-0002-SKIP-MERGE-tests.patchapplication/octet-stream; name=v1-0002-SKIP-MERGE-tests.patchDownload+922-3