Now that CTEs are no longer optimization fences in recent versions of Postgres, is there a way to somehow manually declare an optimization fence around a certain region of the query?
I've had similar problems in Snowflake with the query planner taking a bad path, and no obvious way to hint otherwise.