[PATCH] Add support for SAOP in the optimizer for partial index paths

From: Jim Vanns <james(dot)vanns(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH] Add support for SAOP in the optimizer for partial index paths
Date: 2025-12-05 14:59:07
Message-ID: CA+PSi_-rsp8hvP-wUJrLirKE1nw+7Q0kqqkvU_EyNOD3ZuZ3CQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Postgres hackers,

This is my first patch to the project and I've been sitting on it for 6 months!

This patch was produced via:

git diff -p -U 4d936c3fff1ac8dead2cc240ba3da2ed6337257c

The branch point was 4d936c3fff1ac8dead2cc240ba3da2ed6337257c (master
as of 05/12/2025 1445 GMT)

The patch, though a single diff, was generated from 7 logically
distinct commits (feature, tests, expected output etc.).

I hope I've read the submission guides sufficiently. The code change
was based heavily on the existing code in indxpath.c.

Here's a summary of the feature:

Prior to this patch, only BitmapOr paths were considered for partial
indexes. With this patch, we now support ScalarArrayOpExpr clauses
too (i.e. ANY() and IN()).

I found no entry for this feature in the TODO list here;
- https://wiki.postgresql.org/wiki/Todo

However, it has previously been reported/raised here;
- https://www.postgresql.org/message-id/flat/c128bd06-a246-4129-914c-3dee7b13417a%40vondra.me#5b3f3b7e90d6de8c39a095afaea6b460

The new function, generate_bitmap_saop_paths, was largely based on the
existing generate_bitmap_or_paths() function while also glancing at
other array handling code such as that found in backend/utils/adt/xml.c
plus some additional false-starts in backend/optimizer/util/predtest.c

The C code was formatted via;
src/tools/pgindent/pgindent --indent=src/tools/pg_bsd_indent/pg_bsd_indent

Cheers,

Jim Vanns

Attachment Content-Type Size
SAOP-index-optimiser.diff text/x-patch 18.6 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-12-05 15:01:35 Re: Remaining dependency on setlocale()
Previous Message Euler Taveira 2025-12-05 14:58:32 Re: making tid and HOTness of UPDATE available to logical decoding plugins