4 ms·
"Of course I might have been told something that's not quite correct or I might have misunderstood." I think it was a partial truth. In many cases, you can't o
by jeffdavis 13y ago
"Of course I might have been told something that's not quite correct or I might have misunderstood."
I think it was a partial truth. In many cases, you can't optimize because you need to produce the same results as if you had evaluated the CTE in full exactly once.
CTEs are also a convenient place to have an optimization fence, which are sometimes useful. Yes, this conflates the logical and the physical, but that's the way it is in postgres.