Another look into PostgreSQL CTE materialization and non-idempotent subqueries

Another look into PostgreSQL CTE materialization and non-idempotent subqueries 图片 1

A few days ago, I wrote about a surprising planner behavior with CTEs, DELETE, and LIMIT in PostgreSQL, a piece I hastily put together on a bus ride. That post clearly only scratched the surface of a deeper issue that I’ve since spent way too many hours exploring. So here are some more formed thoughts and findings.
The core issue revisited Let’s quickly recap: when using a query like the following, the planner might execute your query in ways you don’t expect.

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论