Re: Analyze results in more expensive query plan - Mailing list pgsql-performance

From David Rowley
Subject Re: Analyze results in more expensive query plan
Date
Msg-id CAKJS1f91kNcgW0HTPJhtWEkW-hbncJpqdpAU6gmcZ=Bx15yR6Q@mail.gmail.com
Whole thread Raw
In response to Re: Analyze results in more expensive query plan  (Jeremy Altavilla <jeremyaltavilla@gmail.com>)
Responses Re: Analyze results in more expensive query plan
List pgsql-performance
On Tue, 21 May 2019 at 08:23, Jeremy Altavilla
<jeremyaltavilla@gmail.com> wrote:
>
> Thanks for the suggestion. I created extended statistics objects for the two tables in question. Unfortunately the
resultingplan was the same (and had the same estimates). It looks like the extended stats discovered a potentially
usefulcorrelation on bag: "2, 3 => 1" (owner_id, bag_type_id => id). I'm guessing this wasn't usable because the docs
state"They are not used to improve estimates for equality conditions comparing two columns". 

I'd say that since the time spent planning is near 3x what is spent
during execution that you're wasting your time trying to speed up the
execution.  What you should be thinking about is using PREPAREd
statements to avoid the planning overhead completely.  If that's not
possible then you've more chance of reducing the time spent planning
by reducing the statistics on the table rather than adding more
planning overhead by adding extended stats.  You might want to
experiment with ALTER TABLE ... ALTER COLUMN ... SET STATISTICS ..;
and setting those down a bit then analyzing the tables again.
Although, that's likely only going to make a very small difference, if
any, than getting rid of the planning completely.

--
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services



pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Temporarily very slow planning time after a big delete
Next
From: Walter Smith
Date:
Subject: Re: Temporarily very slow planning time after a big delete