Jan Michel <Jan@xxxxxxxxxxxxxxx> writes: > All tables are generated freshly from scratch by the same script only > minutes before this query is run. I tested them all individually and > never saw any problem, all use the same plan. As soon as I run two in > parallel it happens. I also did a test by feeding two tables with > identical data - again the same problem. Hm. Are you explicitly ANALYZE'ing the newly-built tables in your script, or are you just trusting auto-analyze to get the job done? It seems possible that auto-analyze manages to finish before you start your big query if there's just one set of tables to analyze, but not if there's two sets. That would explain bad choices of plans ... regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance