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 1h6c9b-0006yl-D8 for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Mar 2019 14:25:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h6c9Z-00089r-Oy for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Mar 2019 14:25:13 +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 1h6c9Z-00089k-Hm for pgsql-hackers@lists.postgresql.org; Wed, 20 Mar 2019 14:25:13 +0000 Received: from mail-qt1-f194.google.com ([209.85.160.194]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h6c9W-0001MX-3w for pgsql-hackers@postgresql.org; Wed, 20 Mar 2019 14:25:13 +0000 Received: by mail-qt1-f194.google.com with SMTP id k2so2728877qtm.1 for ; Wed, 20 Mar 2019 07:25:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=pPCF16HvOWGwoCxLdBXl/I5Ava9EBd60XeIm/6m2rvk=; b=louSkF+zKR3jxW9dMs2/W/Ss/H0kbOaVBPp3JcnbA8rdCl9i4Q0NPC3D5cjMom4Y2h rLvn2b5sL5vLcGevQRg+RKCBrMrkXbK9ehVu2sChumhxvPDE2b7oMaf0DoSVr14Op+m/ CQ/TeNIP7s8+aTWr92w08ibMur06p5GelGgIPpmuus4PRm1xhtOxun2qCNC7wKah/ZLH G5Th5smRIZlq+ABI99oCEWrabTU1ooCuYQhiOVq0V+7mAWDJ/NKNU+rJgj1p+Efi3Pkx JAmavdo0LYIR11NWujulE6gcG5RRHKu447A36koDvnc5JWPdVpxEWR1s7+UEPkJ+DcFf XkbA== X-Gm-Message-State: APjAAAW9ryGAThu0Il6dOt1lPLbrQpzF7x7+o+JSaTp5QUz8iZ5H/1EY oBEm2q8tQsdG24pnDQKME5ia3NDv8u8= X-Google-Smtp-Source: APXvYqxF3sZaH8li6xIznapsHz/nn6DeKeISqe7bqtVN10yigxBaHRCXkkRx314u0chKk19BkDhoQg== X-Received: by 2002:ac8:fb0:: with SMTP id b45mr7276254qtk.293.1553091907058; Wed, 20 Mar 2019 07:25:07 -0700 (PDT) Received: from localhost.localdomain (c-24-61-8-151.hsd1.ma.comcast.net. [24.61.8.151]) by smtp.gmail.com with ESMTPSA id k17sm1040499qtj.59.2019.03.20.07.25.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Mar 2019 07:25:06 -0700 (PDT) Reply-To: jesper.pedersen@redhat.com Subject: Re: speeding up planning with partitions To: "Imai, Yoshikazu" , 'Amit Langote' , 'Amit Langote' Cc: Tom Lane , David Rowley , Alvaro Herrera , Robert Haas , Justin Pryzby , Pg Hackers References: <80afef3f-1870-5cb3-eeaf-7d8ecb41994c@lab.ntt.co.jp> <0F97FA9ABBDBE54F91744A9B37151A5129DD55@g01jpexmbkw24> <256b9c87-b687-6f51-6274-19ae5743aef6@lab.ntt.co.jp> <0F97FA9ABBDBE54F91744A9B37151A5129E604@g01jpexmbkw24> <9feacaf6-ddb3-96dd-5b98-df5e927b1439@lab.ntt.co.jp> <0F97FA9ABBDBE54F91744A9B37151A512B3279@g01jpexmbkw24> <0c90ce90-b010-4791-41c0-a0df34f99ffa@lab.ntt.co.jp> <0F97FA9ABBDBE54F91744A9B37151A512B3528@g01jpexmbkw24> <0F97FA9ABBDBE54F91744A9B37151A512B359C@g01jpexmbkw24> <72094fc9-3232-0fc7-b7cd-42e1c73d5aee@lab.ntt.co.jp> <0F97FA9ABBDBE54F91744A9B37151A512B45CD@g01jpexmbkw24> From: Jesper Pedersen Organization: Red Hat Message-ID: <53a80692-c68d-5e11-1014-6441b6e8ca5a@redhat.com> Date: Wed, 20 Mar 2019 10:25:05 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <0F97FA9ABBDBE54F91744A9B37151A512B45CD@g01jpexmbkw24> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 3/19/19 11:15 PM, Imai, Yoshikazu wrote: > Here the details. > > [creating partitioned tables (with 1024 partitions)] > drop table if exists rt; > create table rt (a int, b int, c int) partition by range (a); > \o /dev/null > select 'create table rt' || x::text || ' partition of rt for values from (' || > (x)::text || ') to (' || (x+1)::text || ');' from generate_series(1, 1024) x; > \gexec > \o > > [select1024.sql] > \set a random (1, 1024) > select * from rt where a = :a; > > [pgbench] > pgbench -n -f select1024.sql -T 60 > > My tests - using hash partitions - shows that the extra time is spent in make_partition_pruneinfo() for the relid_subplan_map variable. 64 partitions: make_partition_pruneinfo() 2.52% 8192 partitions: make_partition_pruneinfo() 5.43% TPS goes down ~8% between the two. The test setup is similar to the above. Given that Tom is planning to change the List implementation [1] in 13 I think using the palloc0 structure is ok for 12 before trying other implementation options. perf sent off-list. [1] https://www.postgresql.org/message-id/24783.1551568303%40sss.pgh.pa.us Best regards, Jesper