Re: BUG #15947: Worse plan is chosen after giving the planner more freedom (partitionwise join)

From: Keith <keith(at)keithf4(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: ladayaroslav(at)yandex(dot)ru, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15947: Worse plan is chosen after giving the planner more freedom (partitionwise join)
Date: 2019-08-14 00:46:16
Message-ID: CAHw75vuCkA1z-tqs9=B9ZyxTij_5UsOxFULGAa_-xZ39R8F=Gg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> Another point that this example raises is that letting autoanalyze
> ignore partition parent tables is not just a minor problem, but
> a potentially serious bug, causing very poor plan choices to be
> made for any nontrivial queries involving partitioned tables.
>
> regards, tom lane
>
>
>
I ran into this issue frequently with pg_partman well before native
partitioning. It's why I'd initially had the internal maintenance process
run an analyze from the parent table whenever a new child table was made.
Otherwise constraint exclusion didn't always work right. But it began
causing too much of an issue with the maintenance runs because really large
partition sets would then cause maintenance to take a really, really long
time sometimes, potentially holding locks that could block normal table
usage. So as of PG11 I no longer do the analyze by default, but it can
still be turned on.

If there was some way to have autoanalyze kick in on the parent whenever a
new child table is created in a set, that would probably help greatly.
Could run with the same priority as the normal autoanalyze, so queries that
would come in that require a higher lock could cancel it (assuming that's
how that works?) and it could resume later. But something really does need
to be done here to keep set-wide stats current so the exclusion/pruning
process work better.

Keith Fiske

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Langote 2019-08-14 01:47:34 Re: BUG #15954: Unable to alter partitioned table to set logged
Previous Message PG Bug reporting form 2019-08-13 22:36:49 BUG #15957: Connection event listener not called during close()