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 1gRrIU-00073v-Qj for pgsql-performance@arkaria.postgresql.org; Wed, 28 Nov 2018 04:17:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gRrIT-0000sp-La for pgsql-performance@arkaria.postgresql.org; Wed, 28 Nov 2018 04:17:57 +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 1gRrIT-0000sh-Ai for pgsql-performance@lists.postgresql.org; Wed, 28 Nov 2018 04:17:57 +0000 Received: from mail-it1-x143.google.com ([2607:f8b0:4864:20::143]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gRrIQ-0002aX-98 for pgsql-performance@lists.postgresql.org; Wed, 28 Nov 2018 04:17:56 +0000 Received: by mail-it1-x143.google.com with SMTP id p197so2245968itp.0 for ; Tue, 27 Nov 2018 20:17:54 -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=a56a2T+oOHpmJrG440UDEeMtDolx87hHoy8pYIssowk=; b=INr9l/IU+45PWTSez97gYbdgXiCSBYk8ztkr3P1OZcYnWxTZsYmCThgeiXGcM+ZK3O WMTPr1/ABZwVInk0tycY0iklWO31vAHWcdFI6W5ISGZ1DbKVMmI1xMfFF62lNIueu/rz AsVoPfxCO2vMAMMRDFdezo/HC4zHzV626hEBG0LibXJK1BlfytrAroWtX1CgONRqyDgy 8jxpKbX6yhCw6A++8b1jdcfrFJq+o8tjrw74+JQx3ssUx20dpUpHzS8vQ9Qq3+nZo1iw ybBsIbyWYnA6q/jneMZN5iAebVOT3QsLp7E8bP1V8+ZXUZwON3OnQxlVg329b/gI64Zc F29w== 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=a56a2T+oOHpmJrG440UDEeMtDolx87hHoy8pYIssowk=; b=Vv3zfpDsjE/Ceu5u6f7wE+aQZJ3pBVjzHM27umvLplsE77tVe707MhLs4HQ+yUi2Gd 1R5tsE8k7ush7w1J1TkWgucqF1BNDe22+bLw0I61vqYpwP4+tuOwPG0FlmklqejBGwCe efzibrwrCJhGfPdTxegFmdY+DLznMCjItP4a0rpASDfyKtkSWMjk8u4N1dVccFWyhP55 p7DRPr0Ms2hilIEyshk0FaTmuCpLQZ+iPQx+GDfOhVo9EdcF9yFUS1Grv6DROpManE2n PrktGirIaDiZipQhmi54CwmrniEIDuQrVzikUuI316cGZ7AL1bibTOnKueoXxfLY4KfJ J7IQ== X-Gm-Message-State: AA+aEWb6YqdGBS2ektmA/+aJ95fPQRHb3Tx7Bd/xKJdi7kvMLM6M1GpX M9JYJot8MyvZwBpDIH0f8DfwsQ== X-Google-Smtp-Source: AFSGD/XDcBUDhPnG3+EDNTTJs+2u3OKNlmD119V6E2/dz7DzpHJMDrpbPHMc1Y8660UW7cB2tDSQtQ== X-Received: by 2002:a24:508a:: with SMTP id m132-v6mr1283911itb.19.1543378672674; Tue, 27 Nov 2018 20:17:52 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id z1sm2077990iog.57.2018.11.27.20.17.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Nov 2018 20:17:52 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id 086948023CC; Tue, 27 Nov 2018 22:17:50 -0600 (CST) Date: Tue, 27 Nov 2018 22:17:50 -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: <20181128041750.GH30707@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: > Does it still take that long after running ANALYZE on the partitioned table? Yes ; I've just reproduced the problem with a variation on Sanyo's query, retrofitted onto the empty "partbench" table you used for testing in July: https://www.postgresql.org/message-id/CAKJS1f8qkcwr2DULd%2B04rBmubHkKzp4abuFykgoPUsVM-4-38g%40mail.gmail.com Note, Sanyo's original query appears to be a poor-man's window function, joining two subqueries on a.value=max(b.value). I reduced issue to this: |postgres=# ANALYZE partbench; |postgres=# explain SELECT * FROM (SELECT a.i2-b.i2 n FROM partbench a, (SELECT i2 FROM partbench)b)b, (SELECT max(partbench.i3) m FROM partbench, (SELECT i3 FROM partbench)y )y WHERE m=n; |Time: 31555.582 ms (00:31.556) Justin