"Steven Flatt" <steven.flatt@xxxxxxxxx> writes: > I can fix this problem by using CREATE TEMP TABLE ... LIKE instead of CREATE > TEMP TABLE ... AS. That seems ... um ... bizarre. Now are you able to put together a self-contained test case? Seems like we could have two independent bugs here: first, why (and how) is the temp table different, and second how does that result in the observed performance problem. regards, tom lane