Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VmXnD-0007Je-Tn for pgsql-performance@arkaria.postgresql.org; Fri, 29 Nov 2013 23:48:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VmXnD-0005zE-CA for pgsql-performance@arkaria.postgresql.org; Fri, 29 Nov 2013 23:48:15 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VmXnB-0005xN-Eu for pgsql-performance@postgresql.org; Fri, 29 Nov 2013 23:48:13 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VmXn9-0004wy-AD for pgsql-performance@postgresql.org; Fri, 29 Nov 2013 23:48:12 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id rATNm7bY021794; Fri, 29 Nov 2013 18:48:07 -0500 From: Tom Lane To: Jan Michel cc: Jeff Janes , "pgsql-performance@postgresql.org" Subject: Re: One query run twice in parallel results in huge performance decrease In-reply-to: <52991D59.9050100@mueschelsoft.de> References: <5299103F.1040307@mueschelsoft.de> <52991D59.9050100@mueschelsoft.de> Comments: In-reply-to Jan Michel message dated "Sat, 30 Nov 2013 00:03:53 +0100" Date: Fri, 29 Nov 2013 18:48:07 -0500 Message-ID: <21793.1385768887@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Jan Michel 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@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance