Michael Lewis <mlewis@xxxxxxxxxxx> writes: > If you move the limit 1 to the first CTE, does it not give you the same > behavior in both versions? Not sure if that's exactly the same, but certainly adding a traditional optimization fence (OFFSET 0) to the first CTE should do the trick. regards, tom lane