Обсуждение: pgsql: Allow Incremental Sorts on GiST and SP-GiST indexes
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(-)