Schema query changes execution time with larger number of tables 7ms –> 1254ms – PG16.3 on UBUNTU 24.04
The following SQL query which runs from an open source library I’m using finds the foreign key constraints within a schema/table. However the PG optimiser changes the way it optimises the query based upon the number of tables in the SCHEMA. Does anyone know if there is a way to force the use of the faster optimisation method? This query can be run on any recent version of Postgres.