pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Allow Incremental Sorts on GiST and SP-GiST indexes
Date: Tue, 04 Jul 2023 11:09:09 +0000
Message-ID: <E1qGdu9-001rUo-P9@gemulon.postgresql.org> (raw)

Allow Incremental Sorts on GiST and SP-GiST indexes

Previously an "amcanorderbyop" index would only be used when the index
could provide sorted results which satisfied all query_pathkeys.  Here
we relax this so that we also allow these indexes to be considered by the
planner when they only provide partially sorted results.  This allows the
planner to later consider making use of an Incremental Sort to satisfy the
remaining pathkeys.  This change is particularly useful for KNN-type
queries which contain a LIMIT clause and an additional ORDER BY clause for
a non-indexed column.

Author: Miroslav Bendik
Reviewed-by: Richard Guo, David Rowley
Discussion: https://postgr.es/m/CAPoEpV0QYDtzjwamwWUBqyWpaCVbJV2d6qOD7Uy09bWn47PJtw%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/625d5b3ca0968c1d8c080d5210f7209184c0d134

Modified Files
--------------
src/backend/optimizer/path/indxpath.c          | 53 ++++++++++++++------------
src/test/regress/expected/incremental_sort.out | 33 ++++++++++++++++
src/test/regress/sql/incremental_sort.sql      | 16 ++++++++
3 files changed, 77 insertions(+), 25 deletions(-)



Message-ID: <E1qGdu9-001rUo-P9@gemulon.postgresql.org>
Permalink:  ../E1qGdu9-001rUo-P9@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qGdu9-001rUo-P9@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: drowley@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Allow Incremental Sorts on GiST and SP-GiST indexes
  In-Reply-To: <E1qGdu9-001rUo-P9@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox