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 1gxEAm-0000am-LF for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Feb 2019 16:59:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gxEAl-0002uH-90 for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Feb 2019 16:59:39 +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 1gxEAk-0002qD-T0 for pgsql-hackers@lists.postgresql.org; Fri, 22 Feb 2019 16:59:39 +0000 Received: from mail-io1-xd41.google.com ([2607:f8b0:4864:20::d41]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gxEAi-0007Ty-3S for pgsql-hackers@postgresql.org; Fri, 22 Feb 2019 16:59:38 +0000 Received: by mail-io1-xd41.google.com with SMTP id y13so2247413iop.11 for ; Fri, 22 Feb 2019 08:59:35 -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=JmrSzL2WYppbHrtS1t7gTHuaXNQuOQL1MuCxAFD6td4=; b=f5dIgLsKm67Si0D/V79pT50UNlazoKPH6qEu3omDtz8XCtGMmvxUIHhS0Y6dzyoddd HnVBwS3TzGNdmAwrInSVk83+ZVgLS5JkAyxnQzHG42ZmiWy9uetHvV36E+Jw5AvDJ4Qk y4/H9y0ZMZR/b+yTESJULDcmCd6cbOAVBZ0iV6WBB1rmAMqE6i+pcLTlb3kAo3HgyHh1 l+eWQRjJ1u7mqVlRvLlP9eYCmWUokEft43dov158vrFf2nkXQxeFZ4r/JC/JBjgsQAP7 nLT4z7NehqZYW5mb1mH3T75MhXK96v3r+7ZkofGiMk23b5WgJD57rYPRyUcuT5+UJq4b Pu+g== 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=JmrSzL2WYppbHrtS1t7gTHuaXNQuOQL1MuCxAFD6td4=; b=cY4muGZzgPVpST1tNrjl/JMeZHn+L/Dhyo0XMUiZSk8BGkAL7MoAIjGjDHgfEqu7Ua XuFTsNwXgP1NbF3+7ZyvfEienzbVVN9VmYaBLLTv/K6cFmxdvezWmIc+NjfkEsMCgJag Mvm3U9yceAr8fYSdmHeS5PT6YuDZShR4kWFiipqLie4zOsyW14Cfa7uSP1haQBeF+3t/ PRDytjUVjQ8DDyBk/okaVDs02yb6EIk7IkGXLzpnaTQp+IROhOxgBmNS3z0mpI5XbWVb xQFQX+FFCJ3aOVOCZ7o4i4wBd7wF7WFryyfuq3hIe9C5aMHPUpKIj3LAlgaqE8ShexXd 853w== X-Gm-Message-State: AHQUAuY/KBxD/olfHigG8mLq8nERGjgJyjJxvsjW2HITvUVwCzPFarUX Uha0Qc/e0Il1i0n2UTUm5weatQ== X-Google-Smtp-Source: AHgI3IYXzq2Ox+Cq2D21HmnTmeWpYzzcpz2VXn1O7sqv8NHun5pbJIawhtJZGeKeK4Twr3rOvPdS0w== X-Received: by 2002:a5d:9947:: with SMTP id v7mr2929244ios.81.1550854774568; Fri, 22 Feb 2019 08:59:34 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id l134sm909754itb.12.2019.02.22.08.59.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Feb 2019 08:59:33 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id 4FF13800B9A; Fri, 22 Feb 2019 10:59:32 -0600 (CST) Date: Fri, 22 Feb 2019 10:59:32 -0600 From: Justin Pryzby To: Amit Langote Cc: Tom Lane , David Rowley , "Imai, Yoshikazu" , Amit Langote , Alvaro Herrera , Pg Hackers Subject: Re: speeding up planning with partitions Message-ID: <20190222165932.GG28750@telsasoft.com> References: <7453.1550518972@sss.pgh.pa.us> <0a70234e-b2e6-debc-2fb5-e8fd927caa00@lab.ntt.co.jp> <1002.1550596071@sss.pgh.pa.us> <30961.1550609873@sss.pgh.pa.us> <250c61bc-479c-92f4-d19d-d768e3bcdcbc@lab.ntt.co.jp> <13510.1550677844@sss.pgh.pa.us> <35b02675-83c2-a12b-961a-fec249b06f35@lab.ntt.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <35b02675-83c2-a12b-961a-fec249b06f35@lab.ntt.co.jp> User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Feb 22, 2019 at 09:45:38PM +0900, Amit Langote wrote: > I have updated the inheritance expansion patch. > > Patch 0001 rewrites optimizer/utils/inherit.c, so that it allows Thanks for your continued work on this. I applied v23 patch and imported one of our customers' schema, and ran explain on a table with 210 partitions. With patch applied there are 10x fewer system calls, as intended. with patch: 173 pread64 76 lseek 47 open 38 brk without patch: 1276 lseek 693 pread64 647 open 594 brk > + if (IS_SIMPLE_REL(rel1) && child_rel1 == NULL) > + child_rel1 = build_dummy_partition_rel(root, rel1, baserel1, > + cnt_parts); > + if (IS_SIMPLE_REL(rel1) && child_rel2 == NULL) > + child_rel2 = build_dummy_partition_rel(root, rel2, baserel2, > + cnt_parts); Should 2nd "if" say IS_SIMPLE_REL(rel2) ? Justin