Re: Query with high planning time at version 11.1 compared versions 10.5 and 11.0

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Sanyo Moura <sanyo(dot)moura(at)tatic(dot)net>
Cc: jeff(dot)janes(at)gmail(dot)com, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Query with high planning time at version 11.1 compared versions 10.5 and 11.0
Date: 2018-11-28 03:01:29
Message-ID: 20181128030129.GG30707@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

On Tue, Nov 27, 2018 at 11:36:09PM -0200, Sanyo Moura wrote:
> However, in the test I did in version 11.0, "Precio" is partitioned into
> only 21 partitions. So it really is a problem introduced in version 11, and
> it has to do with a large number of partitions in a table.

Thanks for confirming. My test works fine without FK CONSTRAINTs; as you said,
it's an issue of unreasonably high overhead of many partitions.

SELECT 'CREATE TABLE public.precio_'||i||' PARTITION OF public.precio (PRIMARY KEY (fecha, pluid, loccd) ) FOR VALUES FROM ('''||a||''')TO('''||b||''') ' FROM (SELECT '1990-01-01'::timestamp+(i||'days')::interval a, '1990-01-02'::timestamp+(i||'days')::interval b, i FROM generate_series(1,999) i)x;

This issue was discussed here:
https://www.postgresql.org/message-id/flat/94dd7a4b-5e50-0712-911d-2278e055c622%40dalibo.com

Which culminated in this commit.

|commit 7d872c91a3f9d49b56117557cdbb0c3d4c620687
|Author: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
|Date: Tue Jun 26 10:35:26 2018 -0400
|
| Allow direct lookups of AppendRelInfo by child relid

I tried with PG11.1 the test given here:
https://www.postgresql.org/message-id/CAKJS1f8qkcwr2DULd%2B04rBmubHkKzp4abuFykgoPUsVM-4-38g%40mail.gmail.com
with 999 partitions: Planning Time: 50.142 ms
with 9999 partitions: Planning Time: 239.284 ms
..close enough to what was reported.

So it seems there's something about your query which isn't handled as intended.

Adding relevant parties to Cc - find current thread here:
https://www.postgresql.org/message-id/flat/CAO698qZnrxoZu7MEtfiJmpmUtz3AVYFVnwzR%2BpqjF%3DrmKBTgpw%40mail.gmail.com

Justin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-11-28 03:10:26 Re: "pg_ctl: the PID file ... is empty" at end of make check
Previous Message Andres Freund 2018-11-28 02:31:31 Re: logical decoding vs. VACUUM FULL / CLUSTER on table with TOAST-ed data

Browse pgsql-performance by date

  From Date Subject
Next Message David Rowley 2018-11-28 04:03:15 Re: Query with high planning time at version 11.1 compared versions 10.5 and 11.0
Previous Message Sanyo Moura 2018-11-28 01:36:09 Re: Query with high planning time at version 11.1 compared versions 10.5 and 11.0