pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeremy Altavilla <jeremyaltavilla@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Analyze results in more expensive query plan
Date: Fri, 17 May 2019 09:35:35 -0400
Message-ID: <6605.1558100135@sss.pgh.pa.us> (raw)
In-Reply-To: <CAG3Nut_TY+cn_THAW3PKE+cNUod8HbaLu+tADrT4vEGcvUWCRg@mail.gmail.com>
References: <CAG3Nut_TY+cn_THAW3PKE+cNUod8HbaLu+tADrT4vEGcvUWCRg@mail.gmail.com>

Jeremy Altavilla <jeremyaltavilla@gmail.com> writes:
> We have several select statements whose performance is greatly improved by
> deleting some stats from pg_statistic.

You might have better results by setting up some "extended stats" for
the combination of bag_type columns that this query depends on.  Per your
description, there's a fair amount of cross-column correlation, which
the planner will not expect without some extended stats to tell it so.

https://www.postgresql.org/docs/10/planner-stats.html#PLANNER-STATS-EXTENDED

			regards, tom lane





view thread (8+ messages)  latest in thread

Message-ID: <6605.1558100135@sss.pgh.pa.us>
Permalink:  ../6605.1558100135@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6605.1558100135@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, jeremyaltavilla@gmail.com
  Subject: Re: Analyze results in more expensive query plan
  In-Reply-To: <6605.1558100135@sss.pgh.pa.us>

* 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