Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gSANZ-0003FA-Af for pgsql-performance@arkaria.postgresql.org; Thu, 29 Nov 2018 00:40:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gSANX-0005Lm-Dh for pgsql-performance@arkaria.postgresql.org; Thu, 29 Nov 2018 00:40:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gSANX-0005Le-1o for pgsql-performance@lists.postgresql.org; Thu, 29 Nov 2018 00:40:27 +0000 Received: from mail-it1-x131.google.com ([2607:f8b0:4864:20::131]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gSANU-00051q-2x for pgsql-performance@lists.postgresql.org; Thu, 29 Nov 2018 00:40:26 +0000 Received: by mail-it1-x131.google.com with SMTP id i145so72715ita.4 for ; Wed, 28 Nov 2018 16:40:23 -0800 (PST) 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=lIRdDPh3z1ZAtpsndboZE87VKTzpiYswgV5oraASnBs=; b=A4VIeX5WM0GzlpjSJKvRQU4lmuE7pppSK/TimHpYBd6/2SbUt7hENEGcTQdW33QQ9p ENyl3DjAOdpUGuJdbmnpaEFyRI+tCuFk07tzOb1HcvjzJnHllBGxCfQZtYOwtyC9aF9G JhwrcRegpAqtpN+zvymPrIWUlfe0Nw7R3f6+luI1+3ehHWOFU/VLU0ncEjnoiD7beXuG eAGTQP2wsCBtS1eT+gK+mVBfDlyAUAPsptWW83TAjAijblRLai2iLXjPi7vGgVjMO26W k/bTbISMEdWWpI2QauoIsKVtQDxmKpMpVDyiRnyYaCJDCugC+cGuZijNHO/5A0VXmUSp Etqw== 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=lIRdDPh3z1ZAtpsndboZE87VKTzpiYswgV5oraASnBs=; b=ElTGLHLrhGM/rbB6IeWaR6HQ4mQ3FeJlAFP6dzj3RjMu787aw6grmWtnaIFh511dCL p9VdQeXwEqjHUwsMNSPRQTZElhnXwEezZyVSl7vcEhQVNHgej1voibnlws1ey51mJLVO KEqX4iEcUi+OEOkARxLD7s0i4pX/wtATrn77HDUCyfAghNSD6T048QkK5M4wBtwb71O8 lyT6VYgcEgkjOaO0aD3gKh109pjgf6wfhtU+n/mE70ZcaISNXNcW9GSQl18vy8MCEJva czk1gPsz1QCGByGy3GL2ZEi+0smz3AgSwWWT7DJuiiHvEQzp/YHLiXpOX5EtnA5bLNob fiZg== X-Gm-Message-State: AA+aEWaoUI+1v6nQog0V0ZbG5cZPxbqYgkp2Msh4i2D1cZWf1KdVMW1G d7juZtdt3d+jcgcXHbXapeK8ww== X-Google-Smtp-Source: AFSGD/V7kf0Ay3HfIZtnhNJmQgvLUE4psjuOAB/yasEQ4su0pq9bb6dBzQakzT3g2sovXXQ/p+VCDw== X-Received: by 2002:a02:8c4a:: with SMTP id j10mr26660120jal.129.1543452021799; Wed, 28 Nov 2018 16:40:21 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id z23sm93811iob.19.2018.11.28.16.40.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Nov 2018 16:40:21 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id 73C508023D2; Wed, 28 Nov 2018 18:40:19 -0600 (CST) Date: Wed, 28 Nov 2018 18:40:19 -0600 From: Justin Pryzby To: David Rowley Cc: sanyo.moura@tatic.net, pgsql-performance@lists.postgresql.org Subject: Re: Query with high planning time at version 11.1 compared versions 10.5 and 11.0 Message-ID: <20181129004019.GA6805@telsasoft.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Nov 28, 2018 at 05:03:15PM +1300, David Rowley wrote: > On Wed, 28 Nov 2018 at 03:16, Sanyo Moura wrote: > > 11.0 > > Planning Time: 7.238 ms > > Planning Time: 2.638 ms > > > > 11.5 > > Planning Time: 15138.533 ms > > Execution Time: 2.310 ms > > Does it still take that long after running ANALYZE on the partitioned table? Note, I'm sure 11.5 was meant to say 11.1. Also note this earlier message indicates that "high partitions" tests were with just 10.6 and 11.1, and that times under 11.0 weren't a useful datapoint: On Tue, Nov 27, 2018 at 11:36:09PM -0200, Sanyo Moura wrote: > However, in the test I did in version 11.0, "Precio" is partitioned into > only 21 partitions. I reduced the query a bit further: |postgres=# explain SELECT m-n FROM (SELECT a.i2-b.i2 n FROM partbench a, partbench b WHERE a.i2=b.i2) x, (SELECT max(partbench.i2) m FROM partbench)y WHERE m=n; |Time: 35182.536 ms (00:35.183) I should have said, that's with only 1k partitions, not 10k as you used in June. I also tried doing what the query seems to be aiming for by using a window function, but that also experiences 30+ sec planning time: |explain SELECT rank() OVER(ORDER BY var) AS k FROM (SELECT p.plusalesprice-q.plusalesprice as var from precio p, precio q ) l_variacao |Time: 34173.401 ms (00:34.173) Justin