"David G. Johnston" <david.g.johnston@xxxxxxxxx> writes: > v12 what? That ... > It would help if you can provide a self-contained demonstration > that others can then verify and debug (or explain). ... and that. As this message stands, it's undocumented whining. Please see https://wiki.postgresql.org/wiki/Slow_Query_Questions for the sort of information we need to debug performance issues. There's also https://wiki.postgresql.org/wiki/Guide_to_reporting_problems although that's not oriented specifically to performance issues. (I recall that we have fixed some problems in the past that could lead to unreasonable numbers of temp files in hash joins. Whether there's more to do, or Peter is running a version that lacks those fixes, is impossible to tell with the given info.) regards, tom lane