Improve possible performance regression

Peter Eisentraut <peter@eisentraut.org>

Commit: 7f24c0274385ea3d4c797cc2fd60d9a55f3a8d74
Author: Peter Eisentraut <peter@eisentraut.org>
Date: 2025-03-07T10:46:33Z
Releases: 18.0
Improve possible performance regression

Commit ce62f2f2a0a introduced calls to GetIndexAmRoutineByAmId() in
lsyscache.c functions.  This call is a bit more expensive than a
simple syscache lookup.  So rearrange the nesting so that we call that
one last and do the cheaper checks first.

Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/E1tngY6-0000UL-2n%40gemulon.postgresql.org

Files

PathChange+/−
src/backend/utils/cache/lsyscache.c modified +16 −6

Discussion

Cited messages not in the archive: E1tngY6-0000UL-2n@gemulon.postgresql.org