pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: legrand legrand <legrand_legrand@hotmail.com>
To: pgsql-general@postgresql.org
Subject: One Partition by list is always chosen by planner
Date: Mon, 20 Nov 2017 15:54:02 -0700 (MST)
Message-ID: <1511218442722-0.post@n3.nabble.com> (raw)

Hello,

after creating a table wiki_data_part with
partition by list (category);

and creating partitions like
CREATE TABLE wiki_data_part_a PARTITION OF wiki_data_part
FOR VALUES IN ('ang.q',...,'arc');
CREATE TABLE wiki_data_part_b PARTITION OF wiki_data_part
FOR VALUES IN ('bs.s',...,'bg.n');

copy table wiki_data_part from ...;

analyze wiki_data_part;

explain select * from wiki_data_part where category='en'

| Append  (cost=0.00..21595.75 rows=4 width=102)                                                                                                                                                          
|   ->  Seq Scan on wiki_data_part_e  (cost=0.00..21578.00 rows=1 width=102)                                                                                                                              
|         Filter: ((category)::text = 'en'::text)                                                                                                                                                         
|   ->  Seq Scan on wiki_data_part_s  (cost=0.00..17.75 rows=3 width=102)                                                                                                                                 
|         Filter: ((category)::text = 'en'::text)    

partition wiki_data_part_s (that has more than 100 values in its list) is
always scanned,
even when where predicates are not in its values list ...

Problem occurs on
PostgreSQL 10.0, compiled by Visual C++ build 1800, 64-bit
even without data loaded.

If this is a problem of max values, maybe this could be added in doc ?


wiki_data_wrong_part_s_chosen.sql
<http://www.postgresql-archive.org/file/t348768/wiki_data_wrong_part_s_chosen.sql;  



--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html




view thread (5+ messages)  latest in thread

Message-ID: <1511218442722-0.post@n3.nabble.com>
Permalink:  ../1511218442722-0.post@n3.nabble.com/
Also on:    postgresql.org/message-id/1511218442722-0.post@n3.nabble.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: legrand_legrand@hotmail.com
  Subject: Re: One Partition by list is always chosen by planner
  In-Reply-To: <1511218442722-0.post@n3.nabble.com>
  References: <1511218442722-0.post@n3.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox