Internal error XX000 with enable_partition_pruning=on, pg 11 beta1 on Debian

From: Phil Florent <philflorent(at)hotmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Internal error XX000 with enable_partition_pruning=on, pg 11 beta1 on Debian
Date: 2018-06-08 14:10:45
Message-ID: HE1PR03MB17068BB27404C90B5B788BCABA7B0@HE1PR03MB1706.eurprd03.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I obtained an XX000 error testing my DSS application with PostgreSQL 11 beta 1.

Here is a simplified version of my test, no data in the tables :

-- 11
select version();
version

-----------------------------------------------------------------------------------------------------------------------

PostgreSQL 11beta1 (Debian 11~beta1-2.pgdg+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 7.3.0-19) 7.3.0, 64-bit
(1 ligne)

-- connected superuser -- postgres
create user a password 'a';
create schema a authorization a;
create user b password 'b';
create schema b authorization b;
create user c password 'c';
create schema c authorization c;
create user z password 'z';
create schema z authorization z;

-- connected a
create table t1(k1 timestamp, c1 int);
create view v as select k1, c1 from t1;
grant usage on schema a to z;
grant select on all tables in schema a to z;

-- connected b
create table t2(k1 timestamp, c1 int) partition by range(k1);
create table t2_2016 partition of t2 for values from ('2016-01-01') to ('2017-01-01');
create table t2_2017 partition of t2 for values from ('2017-01-01') to ('2018-01-01');
create table t2_2018 partition of t2 for values from ('2018-01-01') to ('2019-01-01');
create view v as select k1, c1 from t2;
grant select on all tables in schema b to z;
grant usage on schema b to z;

-- connected c
create table t3(k1 timestamp, c1 int) partition by range(k1);
create table t3_2016 partition of t3 for values from ('2016-01-01') to ('2017-01-01');
create table t3_2017 partition of t3 for values from ('2017-01-01') to ('2018-01-01');
create table t3_2018 partition of t3 for values from ('2018-01-01') to ('2019-01-01');
create view v as select k1, c1 from t3;
grant select on all tables in schema c to z;
grant usage on schema c to z;

-- connected z
create view v as
select k1, c1 from
(select * from a.v
UNION ALL
select * from b.v
UNION ALL
select * from c.v) vabc ;

explain analyze select * from v where v.k1 > date '2017-01-01';
ERREUR: XX000: did not find all requested child rels in append_rel_list
EMPLACEMENT : find_appinfos_by_relids, prepunion.c : 2643

set enable_partition_pruning=off;
SET

explain analyze select * from v where v.k1 > date '2017-01-01';
QUERY PLAN
-----------------------------------------------------------------------------------------------------------
Append (cost=0.00..272.30 rows=4760 width=12) (actual time=0.217..0.217 rows=0 loops=1)
-> Seq Scan on t1 (cost=0.00..35.50 rows=680 width=12) (actual time=0.020..0.020 rows=0 loops=1)
Filter: (k1 > '2017-01-01'::date)
-> Seq Scan on t2_2016 (cost=0.00..35.50 rows=680 width=12) (actual time=0.035..0.035 rows=0 loops=1)
Filter: (k1 > '2017-01-01'::date)
-> Seq Scan on t2_2017 (cost=0.00..35.50 rows=680 width=12) (actual time=0.016..0.016 rows=0 loops=1)
Filter: (k1 > '2017-01-01'::date)
-> Seq Scan on t2_2018 (cost=0.00..35.50 rows=680 width=12) (actual time=0.015..0.015 rows=0 loops=1)
Filter: (k1 > '2017-01-01'::date)
-> Seq Scan on t3_2016 (cost=0.00..35.50 rows=680 width=12) (actual time=0.040..0.040 rows=0 loops=1)
Filter: (k1 > '2017-01-01'::date)
-> Seq Scan on t3_2017 (cost=0.00..35.50 rows=680 width=12) (actual time=0.016..0.016 rows=0 loops=1)
Filter: (k1 > '2017-01-01'::date)
-> Seq Scan on t3_2018 (cost=0.00..35.50 rows=680 width=12) (actual time=0.016..0.016 rows=0 loops=1)
Filter: (k1 > '2017-01-01'::date)
Planning Time: 0.639 ms
Execution Time: 0.400 ms

set enable_partition_pruning=on;
SET

explain analyze select * from v where v.k1 > date '2017-01-01';
ERREUR: XX000: did not find all requested child rels in append_rel_list
EMPLACEMENT : find_appinfos_by_relids, prepunion.c : 2643

-- 10
select version();
version
--------------------------------------------------------------------------------------------------------------------------------------------

PostgreSQL 10.4 (Ubuntu 10.4-2.pgdg16.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609, 64-bit
(1 ligne)

-- connected superuser -- postgres
create user a password 'a';
create schema a authorization a;

create user b password 'b';
create schema b authorization b;

create user c password 'c';
create schema c authorization c;

create user z password 'z';
create schema z authorization z;

-- connected a
create table t1(k1 timestamp, c1 int);
create view v as select k1, c1 from t1;
grant usage on schema a to z;
grant select on all tables in schema a to z;

-- connected b
create table t2(k1 timestamp, c1 int) partition by range(k1);
create table t2_2016 partition of t2 for values from ('2016-01-01') to ('2017-01-01');
create table t2_2017 partition of t2 for values from ('2017-01-01') to ('2018-01-01');
create table t2_2018 partition of t2 for values from ('2018-01-01') to ('2019-01-01');
create view v as select k1, c1 from t2;
grant select on all tables in schema b to z;
grant usage on schema b to z;

-- connected c
create table t3(k1 timestamp, c1 int) partition by range(k1);
create table t3_2016 partition of t3 for values from ('2016-01-01') to ('2017-01-01');
create table t3_2017 partition of t3 for values from ('2017-01-01') to ('2018-01-01');
create table t3_2018 partition of t3 for values from ('2018-01-01') to ('2019-01-01');
create view v as select k1, c1 from t3;
grant select on all tables in schema c to z;
grant usage on schema c to z;

-- connected z
create view v as
select k1, c1 from
(select * from a.v
UNION ALL
select * from b.v
UNION ALL
select * from c.v) vabc ;

explain analyze select * from v where v.k1 > date '2017-01-01';
QUERY PLAN
-----------------------------------------------------------------------------------------------------------
Append (cost=0.00..177.50 rows=3400 width=12) (actual time=0.206..0.206 rows=0 loops=1)
-> Seq Scan on t1 (cost=0.00..35.50 rows=680 width=12) (actual time=0.044..0.044 rows=0 loops=1)
Filter: (k1 > '2017-01-01'::date)
-> Seq Scan on t2_2017 (cost=0.00..35.50 rows=680 width=12) (actual time=0.020..0.020 rows=0 loops=1)
Filter: (k1 > '2017-01-01'::date)
-> Seq Scan on t2_2018 (cost=0.00..35.50 rows=680 width=12) (actual time=0.020..0.020 rows=0 loops=1)
Filter: (k1 > '2017-01-01'::date)
-> Seq Scan on t3_2017 (cost=0.00..35.50 rows=680 width=12) (actual time=0.036..0.036 rows=0 loops=1)
Filter: (k1 > '2017-01-01'::date)
-> Seq Scan on t3_2018 (cost=0.00..35.50 rows=680 width=12) (actual time=0.020..0.020 rows=0 loops=1)
Filter: (k1 > '2017-01-01'::date)
Planning time: 0.780 ms
Execution time: 0.427 ms

Best regards

Phil

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2018-06-08 14:20:45 Re: Performance regression with PostgreSQL 11 and partitioning
Previous Message Jeff Janes 2018-06-08 13:59:20 Re: High CPU load caused by the autovacuum launcher process