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 1gRq6d-00041N-I0 for pgsql-performance@arkaria.postgresql.org; Wed, 28 Nov 2018 03:01:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gRq6a-00037l-Us for pgsql-performance@arkaria.postgresql.org; Wed, 28 Nov 2018 03:01:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gRq6Z-00037e-QN for pgsql-performance@lists.postgresql.org; Wed, 28 Nov 2018 03:01:36 +0000 Received: from mail-io1-xd43.google.com ([2607:f8b0:4864:20::d43]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gRq6W-0007fw-73 for pgsql-performance@lists.postgresql.org; Wed, 28 Nov 2018 03:01:34 +0000 Received: by mail-io1-xd43.google.com with SMTP id m19so18790198ioh.3 for ; Tue, 27 Nov 2018 19:01:31 -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=5vtpJlPnKCtWu+Wnkf4/qqNr2b8qkIlrOfAlIWnYef0=; b=Ebxg9+jam7VnOAEMNLxG9pRvQyf6b5JdaXh6ZVdoj7j3+ofm/DHxteqjx+iyLgG/Bn nKPjrNiGTjBEwVBIUBULnTMu92eMa4M+bSki1DdckvolmpvNoD3DPgAzhXTY6uO4b+Mk nkheD2JcMC9KKl/FjUn2vavVZSBiyfrCK2rthdjZlFY4XDmrUfrdM3jkBbl1D3yYEpW/ sKQOdcJb9OoNDdt3BHa9Vmy4NpP1RvTCEYSfxf6JzIXfug9AiDKaw/jsXVMcq5t8CMU/ 2kYsP3IXe0G5hSwqxcma7FPcoLG8UmvYf2FjDXaL9KkyqraGnky2hpRTgqN6pumYpR41 7P7Q== 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=5vtpJlPnKCtWu+Wnkf4/qqNr2b8qkIlrOfAlIWnYef0=; b=gjbYcR2Dhb8zK/0vIbDgw4HBJC/8ogE00QJ80CwgbN8CkbXaoRFokoBd7j5K1LVtCR PAWTPvJ1L6R18OseIxN60cBjuxlS1no+k7wECtN5xgun0HGgMTyKFlEkO1Aaf9psKYtu Pus0apsZyREpevltQilM2vUhzNV8GOI8RL/okOFrf6rQY9apejx8/ufFcKBkWb6oK1sA g6Rz3ppfFRaEClZNOqn1d9ujo53Ef+2DQR7/oDfv8TXOUbDBTCMc5ptSPV3u2/VOaNXf bqSDZUR9x3BxEhcD0FvhkpgKDJ4y2SucdJEaNT6WdlO9xIbytQL8FSgfggzo0utMDLTe s0xg== X-Gm-Message-State: AA+aEWbtHyaKcJ8OlcYKlmODoQOGQaMBTov52OteTANdhP20hAJO/rQW JVFceh7CQ0dL2UgZfxnTdcRS0w== X-Google-Smtp-Source: AFSGD/Xxd4YStPdxC109+AEsc2PGzah2LaWTYondHjA50v/tbAlxnlgUyh6pzZVWJ+WosTnJuB8KMg== X-Received: by 2002:a6b:b7d4:: with SMTP id h203mr26021200iof.163.1543374091264; Tue, 27 Nov 2018 19:01:31 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id l3sm561812itb.43.2018.11.27.19.01.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Nov 2018 19:01:30 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id 53E778025C4; Tue, 27 Nov 2018 21:01:29 -0600 (CST) Date: Tue, 27 Nov 2018 21:01:29 -0600 From: Justin Pryzby To: Sanyo Moura Cc: jeff.janes@gmail.com, Alvaro Herrera , David Rowley , Ashutosh Bapat , 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: <20181128030129.GG30707@telsasoft.com> References: <20181128004402.GC30707@telsasoft.com> <20181128012713.GF30707@telsasoft.com> 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 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. So it really is a problem introduced in version 11, and > it has to do with a large number of partitions in a table. Thanks for confirming. My test works fine without FK CONSTRAINTs; as you said, it's an issue of unreasonably high overhead of many partitions. SELECT 'CREATE TABLE public.precio_'||i||' PARTITION OF public.precio (PRIMARY KEY (fecha, pluid, loccd) ) FOR VALUES FROM ('''||a||''')TO('''||b||''') ' FROM (SELECT '1990-01-01'::timestamp+(i||'days')::interval a, '1990-01-02'::timestamp+(i||'days')::interval b, i FROM generate_series(1,999) i)x; This issue was discussed here: https://www.postgresql.org/message-id/flat/94dd7a4b-5e50-0712-911d-2278e055c622%40dalibo.com Which culminated in this commit. |commit 7d872c91a3f9d49b56117557cdbb0c3d4c620687 |Author: Alvaro Herrera |Date: Tue Jun 26 10:35:26 2018 -0400 | | Allow direct lookups of AppendRelInfo by child relid I tried with PG11.1 the test given here: https://www.postgresql.org/message-id/CAKJS1f8qkcwr2DULd%2B04rBmubHkKzp4abuFykgoPUsVM-4-38g%40mail.gmail.com with 999 partitions: Planning Time: 50.142 ms with 9999 partitions: Planning Time: 239.284 ms ..close enough to what was reported. So it seems there's something about your query which isn't handled as intended. Adding relevant parties to Cc - find current thread here: https://www.postgresql.org/message-id/flat/CAO698qZnrxoZu7MEtfiJmpmUtz3AVYFVnwzR%2BpqjF%3DrmKBTgpw%40mail.gmail.com Justin