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

Justin Pryzby <pryzby@telsasoft.com>

From: Justin Pryzby <pryzby@telsasoft.com>
To: David Rowley <david.rowley@2ndquadrant.com>
Cc: sanyo.moura@tatic.net, pgsql-performance@lists.postgresql.org
Date: 2018-11-28T04:17:50Z
Lists: pgsql-hackers, pgsql-performance
On Wed, Nov 28, 2018 at 05:03:15PM +1300, David Rowley wrote:
> Does it still take that long after running ANALYZE on the partitioned table?

Yes ; I've just reproduced the problem with a variation on Sanyo's query,
retrofitted onto the empty "partbench" table you used for testing in July:
https://www.postgresql.org/message-id/CAKJS1f8qkcwr2DULd%2B04rBmubHkKzp4abuFykgoPUsVM-4-38g%40mail.gmail.com

Note, Sanyo's original query appears to be a poor-man's window function,
joining two subqueries on a.value=max(b.value).

I reduced issue to this:

|postgres=# ANALYZE partbench;
|postgres=# explain SELECT * FROM (SELECT a.i2-b.i2 n FROM partbench a, (SELECT i2 FROM partbench)b)b, (SELECT max(partbench.i3) m FROM partbench, (SELECT i3 FROM partbench)y )y WHERE m=n;
|Time: 31555.582 ms (00:31.556)

Justin


Commits

  1. Postpone generating tlists and EC members for inheritance dummy children.

  2. Allow direct lookups of AppendRelInfo by child relid