Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jVgVd-0004l2-Rz for pgsql-performance@arkaria.postgresql.org; Mon, 04 May 2020 19:12:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jVgVc-0006PC-F0 for pgsql-performance@arkaria.postgresql.org; Mon, 04 May 2020 19:12:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jVgVc-0006P4-43 for pgsql-performance@lists.postgresql.org; Mon, 04 May 2020 19:12:08 +0000 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jVgVZ-0005Tx-Da for pgsql-performance@postgresql.org; Mon, 04 May 2020 19:12:06 +0000 Received: by mail-qk1-x72c.google.com with SMTP id c10so751862qka.4 for ; Mon, 04 May 2020 12:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=g+9hrZRYAfzXNSZspv1MSiDfpvyETTJubDurpLyXZeo=; b=yakE87v9n/Ac7vrzfrs/7UH2eXXAvPF7w9PYvT3dp374LfkY2wrk9JgLqBeFeglzLr w4J5zToROWVlrPNU1eZfJ7pWg76xTwH6wCeQ3ZJDBa+lEEi4Al0AAPaUedTKkiK+3QrT zp8kHa5VOo0jDfblIPD9NN/uARALLvjhvX2+Lxcqi4C2RVs8iFDQ66YlCuanKkcr8JWS A/I0VVjYKanyJ0DEq3hqvOR9hyo54UrMO8qr+bxGfk60sFKmAi4MKUXpZ3kfJTJfyREh VHMOt+cd/rlEeoVI6HMh52P57BQPG8WgUKutkoj8Ydhio29lUyBiTQKJsipuiIKMnMuG TE3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=g+9hrZRYAfzXNSZspv1MSiDfpvyETTJubDurpLyXZeo=; b=I//i/6aKgOHzhEPgRk0tuSWIA5kNa0HKljR2YoCgzpyccPmljoNh1cKPohsVnF5FKz YxsZeRGW43rLzkVDJrlvXiK3CYi78ILixGi/W1B+4py/+5BGsLRmDS9f5FCWStlIiW0u w3cChKpFn2QlwIgBeYZs/+N+9bFr3yaMH5m+0wp3VCyMLRcuKZH9gzA/8wR3DiFKzB/R QhR785lEKdutBfZhR5kk3Pyg3h/cz4HmrdK5feuda2QkDwiqNmHzQV3Ue8pKMnKRdJiV SPrranEIGmkyfJdpZ/xRo/30aJaCLPwh1k58tdq8QwEPRqlO+7onM3qpXwWIa1AA8854 vtWA== X-Gm-Message-State: AGi0Pub9cYGS5rxY8PdsL5D1oyWhwfvHulcx7cytFjEvFi46PjdqPbXp EbOg7OdLGxIRwpEbRkMX8vjnxw== X-Google-Smtp-Source: APiQypITBplqHH+kVZArQ5n/6IOb+lf8oGc0zR3uRts4v89Ig+giOQiBcNqq+1qTrywYxK8kLjFKpA== X-Received: by 2002:a05:620a:692:: with SMTP id f18mr819401qkh.130.1588619523351; Mon, 04 May 2020 12:12:03 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id u7sm10699414qkj.51.2020.05.04.12.12.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 May 2020 12:12:02 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 4D3EC800C5C; Mon, 4 May 2020 14:12:01 -0500 (CDT) Date: Mon, 4 May 2020 14:12:01 -0500 From: Justin Pryzby To: Jamie Thompson Cc: pgsql-performance@postgresql.org Subject: Re: Please help! Query jumps from 1s -> 4m Message-ID: <20200504191201.GU28974@telsasoft.com> References: <20200503153825.GK28974@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, May 04, 2020 at 08:07:07PM +0100, Jamie Thompson wrote: > Additionally, the execution plans for the 10th + following queries look > fine, they have the same structure as if I run the query manually. It's not > that the query plan switches, it seems as though the same query plan is > just > 200X slower than usual. Are you able to reproduce the problem manually ? With/without PREPARE ? https://www.postgresql.org/docs/current/sql-prepare.html -- Justin