AWS RDS Postgresql 12.11
It runs quickly, no matter what the fetched cursor values are, as long as
the cursor returns less than 8 rows. After that, the singleton SELECT's
performance tanks.
We've got plenty of other procedures which have a similar "Singleton SELECT
inside a cursor" design (many even query the same table that the problematic
query does), but only this procedure's singleton SELECT tanks if the cursor
returns more than 8 rows.
It only runs once a month, so we've only just noticed the problem.
Why would that be? (We recently updated from 12.10 to 12.11, if that's
relevant.)
--
Angular momentum makes the world go 'round.