Re: Index AM API cleanup

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Mark Dilger <mark.dilger@enterprisedb.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-04-01T12:50:55Z
Lists: pgsql-hackers

Attachments

On 20.03.25 12:59, Peter Eisentraut wrote:
> v22-0006-Convert-from-StrategyNumber-to-CompareType.patch
> 
> This is all that remains now.  I think with a bit more polishing around 
> the edges, some comment updates, etc., this is close to ready.

Here is an updated version of this patch.  I have left out all the extra 
tests and WIP patches etc. from the series for now so that the focus is 
clear.

This patch is mostly unchanged from the above, except some small amount 
of updating comments, as well as the following.

I've done a fair bit of performance testing to make sure there are no 
noticeable regressions from this patch.  I've found that the function 
get_mergejoin_opfamilies() is quite critical to the planning time of 
even simple queries (such as pgbench --select-only), so I played around 
with various caching schemes.  In the end, I just settled on hardcoding 
information about the built-in index AM types.  Which is of course ugly, 
but at least it's essentially the same as before.  If we find other 
affected hotspots, we could apply similar workarounds, but so far I 
haven't found any.

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Relax ordering-related hardcoded btree requirements in planning

  2. Support non-btree indexes in get_actual_variable_range()

  3. Convert PathKey to use CompareType

  4. Generalize index support in network support function

  5. Update a code comment

  6. Allow non-btree unique indexes for matviews

  7. Allow non-btree unique indexes for partition keys

  8. Add some opfamily support functions to lsyscache.c

  9. Simplify and generalize PrepareSortSupportFromIndexRel()

  10. Generalize hash and ordering support in amapi

  11. Drop opcintype from index AM strategy translation API

  12. Allow non-btree speculative insertion indexes

  13. Support non-btree indexes for foreign keys

  14. Integrate GistTranslateCompareType() into IndexAmTranslateCompareType()

  15. Convert strategies to and from compare types

  16. Move CompareType to separate header file

  17. Add get_opfamily_name() function

  18. Rename GistTranslateStratnum() to GistTranslateCompareType()

  19. Change gist stratnum function to use CompareType

  20. Rename RowCompareType to CompareType

  21. Improve slightly misleading internal error message

  22. Track scan reversals in MergeJoin

  23. Track sort direction in SortGroupClause

  24. Add stratnum GiST support function

  25. Add amgettreeheight index AM API routine