pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: Sanyo Moura <sanyo.moura@tatic.net>
Cc: jeff.janes@gmail.com, Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: David Rowley <david.rowley@2ndquadrant.com>
Cc: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: Query with high planning time at version 11.1 compared versions 10.5 and 11.0
Date: Tue, 27 Nov 2018 21:01:29 -0600
Message-ID: <20181128030129.GG30707@telsasoft.com> (raw)
In-Reply-To: <CAO698qYi=xWnHKAgYw4w6wtsm1pkXdSJV89dzmh2AtU39dhxCg@mail.gmail.com>
References: <CAO698qZnrxoZu7MEtfiJmpmUtz3AVYFVnwzR+pqjF=rmKBTgpw@mail.gmail.com>
	<CAMkU=1wb5JqO9jCgp-3q-40X7c+AtTGw=CZzqF8+iBmua+geVg@mail.gmail.com>
	<CAO698qZRB020VM53gU6EHEM2QcAUE=GxvMS5rWLWBnNE2ACoPA@mail.gmail.com>
	<20181128004402.GC30707@telsasoft.com>
	<20181128012713.GF30707@telsasoft.com>
	<CAO698qYi=xWnHKAgYw4w6wtsm1pkXdSJV89dzmh2AtU39dhxCg@mail.gmail.com>

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@alvh.no-ip.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.g...
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%4...

Justin




view thread (53+ messages)  latest in thread

Message-ID: <20181128030129.GG30707@telsasoft.com>
Permalink:  ../20181128030129.GG30707@telsasoft.com/
Also on:    postgresql.org/message-id/20181128030129.GG30707@telsasoft.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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: pryzby@telsasoft.com, sanyo.moura@tatic.net, alvherre@alvh.no-ip.org, david.rowley@2ndquadrant.com, ashutosh.bapat@enterprisedb.com, pgsql-performance@lists.postgresql.org
  Subject: Re: Query with high planning time at version 11.1 compared versions 10.5 and 11.0
  In-Reply-To: <20181128030129.GG30707@telsasoft.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