On Wed, Jan 11, 2023 at 10:13:11PM -0800, Christophe Pettus wrote: > > Also, IIRC, the SELECTs generated to do foreign key checks do appear in > pg_stat_statements, so that might provide a guide to ones that are consuming > an unusually large amount of resources. Yes, but you need to have pg_stat_statements.track = all configured for that, which isn't the default value (and requires superuser privileges to change).