Re:The Many Faces of Distinct in PostgreSQL
by inferiorhuman on Monday May 22, 2023 @07:11PM
(#36037885)
My experience was that this was not the case. Basically the CTE was materialized and the variables were resolved as part of PREPARE, so each invocation got the same values. I couldn't find the blurb I'd read previously but I did a little digging today and it looks like maybe NOT MATERIALIZED would fix the problem?
[ Parent
| on HN ]
Re:The Many Faces of Distinct in PostgreSQL
by paulddraper on Monday May 22, 2023 @10:09PM
(#36038973)
CTEs used to be an optimization fence, with or without prepared statements.
PG 14 or something changed that.