My mistake. I have updated the query in the gist: cte1 should have been
referenced in cte2.
The query plans are correct. It was just the query in the gist that was
incorrect (I was just verifying cte1 was the culprit – without it the query is
fast too).
This SQL query is a result of transl
Hi everyone,
I have a SELECT query that uses a long chain of CTEs (6) and is executed
repeatedly as part of the transaction (with different parameters). It is
executed quickly most of the time, but sometimes becomes very slow. I
managed to consistently reproduce the issue by executing a transactio