A PostgreSQL planner gotcha with CTEs DELETE and LIMIT
A PostgreSQL planner gotcha with CTEs DELETE and LIMIT
May 3, 2025
Shayon’s article goes over some of the issues using CTEs and how the PostgreSQL planner works. The good part is that Shayon goes through with an example and more importantly analyze the query planner to show the issue.
I think it is a good reminder that while CTEs are good, it is always good to verify that the performance is acceptable and optimize accordingly.