Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1auydt-000666-07 for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Apr 2016 08:46:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1auyds-0006mp-En for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Apr 2016 08:46:48 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1auydr-0006mc-Mg; Tue, 26 Apr 2016 08:46:47 +0000 Received: from lb3-smtp-cloud3.xs4all.net ([194.109.24.30]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1auydk-0007Hz-8w; Tue, 26 Apr 2016 08:46:46 +0000 Received: from webmailclassic.xs4all.nl ([194.109.20.205]) by smtp-cloud3.xs4all.net with ESMTP id mwmZ1s00F4RV18J01wmZB1; Tue, 26 Apr 2016 10:46:35 +0200 Received: from exit1.torproxy.org ([89.187.142.208]) by webmailclassic.xs4all.nl with HTTP (HTTP/1.1 POST); Tue, 26 Apr 2016 10:46:33 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 26 Apr 2016 08:46:33 +0000 From: Erik Rijkers To: Amit Langote Cc: Ashutosh Bapat , Robert Haas , Alexander Korotkov , Amit Langote , Corey Huinker , Pg Hackers , pgsql-hackers-owner@postgresql.org Subject: Re: Declarative partitioning In-Reply-To: <57106F9E.3000309@lab.ntt.co.jp> References: <55D3093C.5010800@lab.ntt.co.jp> <566E6C48.9080500@lab.ntt.co.jp> <5678ACBC.8050809@lab.ntt.co.jp> <5698CE6D.3070907@lab.ntt.co.jp> <56C55973.80309@lab.ntt.co.jp> <56CD6598.4090302@lab.ntt.co.jp> <56DE2D4B.1040001@lab.ntt.co.jp> <56DF74F0.7060404@lab.ntt.co.jp> <56F0AC96.2010303@lab.ntt.co.jp> <57106F9E.3000309@lab.ntt.co.jp> Message-ID: <305d42cd2dc173ae914ca2ef7d4b9710@xs4all.nl> X-Sender: er@xs4all.nl (8IX0OAgPDfd3zs627NNldg==) User-Agent: XS4ALL Webmail X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2016-04-15 04:35, Amit Langote wrote: A quick test with: > 0001-Add-syntax-to-specify-partition-key-v3.patch > 0002-Infrastructure-for-creation-of-partitioned-tables-v3.patch > 0003-Add-syntax-to-create-partitions-v3.patch > 0004-Infrastructure-for-partition-metadata-storage-and-ma-v3.patch > 0005-Introduce-tuple-routing-for-partitioned-tables-v3.patch patches apply, build and make check ok. There is somwthing wrong with indexes on child tables (and only with higher rowcounts). Surely the below code should give 6 rows; it actually does return 6 rows without the indexes. With indexes it returns 0 rows. (but when doing the same test with low rowcounts, things are OK.) thanks, Erik Rijkers (Linux Centos 6.6) --------------------------------------- create table inh(a int, b int) partition by range ((a+b)); create table inh_1 partition of inh for values start ( 0) end ( 10000); create table inh_2 partition of inh for values start ( 10000) end ( 20000); create table inh_3 partition of inh for values start ( 20000) end ( 100000); create index inh_1_a_idx on inh_1 (a); create index inh_2_a_idx on inh_2 (a); create index inh_3_a_idx on inh_3 (a); insert into inh select i, i as j from generate_series(1, 10000) as f(i); analyze inh_1; analyze inh_2; analyze inh_3; select 'inh' , count(*) from inh union all select 'inh_1', count(*) from inh_1 union all select 'inh_2', count(*) from inh_2 union all select 'inh_3', count(*) from inh_3 ; explain analyze select * from inh where a between 10110 and 10115; --------------------------------------- # output : create table inh(a int, b int) partition by range ((a+b)); create table inh_1 partition of inh for values start ( 0) end ( 10000); create index inh_1_a_idx on inh_1 (a); create table inh_2 partition of inh for values start ( 10000) end ( 20000); create index inh_2_a_idx on inh_2 (a); create table inh_3 partition of inh for values start ( 20000) end ( 100000); create index inh_3_a_idx on inh_3 (a); insert into inh select i, i as j from generate_series(1, 10000) as f(i); analyze inh_1; analyze inh_2; analyze inh_3; select 'inh' , count(*) from inh union all select 'inh_1', count(*) from inh_1 union all select 'inh_2', count(*) from inh_2 union all select 'inh_3', count(*) from inh_3 ; ?column? | count ----------+------- inh | 10000 inh_1 | 4999 inh_2 | 5000 inh_3 | 1 (4 rows) explain analyze select * from inh where a between 10110 and 10115; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------- Append (cost=0.00..17.37 rows=4 width=8) (actual time=0.023..0.023 rows=0 loops=1) -> Seq Scan on inh (cost=0.00..0.00 rows=1 width=8) (actual time=0.004..0.004 rows=0 loops=1) Filter: ((a >= 10110) AND (a <= 10115)) -> Index Scan using inh_1_a_idx on inh_1 (cost=0.16..8.18 rows=1 width=8) (actual time=0.007..0.007 rows=0 loops=1) Index Cond: ((a >= 10110) AND (a <= 10115)) -> Index Scan using inh_2_a_idx on inh_2 (cost=0.16..8.18 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=1) Index Cond: ((a >= 10110) AND (a <= 10115)) -> Seq Scan on inh_3 (cost=0.00..1.01 rows=1 width=8) (actual time=0.008..0.008 rows=0 loops=1) Filter: ((a >= 10110) AND (a <= 10115)) Rows Removed by Filter: 1 Planning time: 0.858 ms Execution time: 0.093 ms (12 rows) -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers