| From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> | 
|---|---|
| To: | Justin Pryzby <pryzby(at)telsasoft(dot)com> | 
| Cc: | "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> | 
| Subject: | Re: join estimate of subqueries with range conditions and constraint exclusion | 
| Date: | 2017-06-03 19:23:59 | 
| Message-ID: | CAKFQuwZoZKomiWpAjuopBWY-KfcGvAdAF8H7nQ1eqZtvDpSftQ@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-performance | 
On Wed, May 24, 2017 at 2:17 PM, Justin Pryzby <pryzby(at)telsasoft(dot)com> wrote:
> We got bitten again by what appears to be the same issue I reported
> (perhaps
> poorly) here:
> https://www.postgresql.org/message-id/20170326193344.
> GS31628%40telsasoft.com
>
> We have PG9.6.3 table heirarchies partitioned by time.  Our reports use
> subqueries each with their own copies of a range clauses on time column, as
> needed to get constraint exclusion reference:
> https://www.postgresql.org/message-id/25076.1366321335%40sss.pgh.pa.us
>
>         SELECT * FROM
>         (SELECT * FROM t WHERE col>const) a JOIN
>         (SELECT * FROM t WHERE col>const) b USING (col)
>
> I'm diagnosing a bad estimate/plan due to excessively high n_distinct
> leading
> to underestimated rowcount when selecting from a small fraction of the
> table
> heirarchy.  This leads intermittently to bad things, specifically a
> cascade of
> misestimates and associated nested loops around millions of rows.
>
Justin,
I'm not going to be much help personally but I just wanted to say that with
PGCon just completed and Beta1 just starting, combined with the somewhat
specialized nature of the problem, a response should be forthcoming even
though its taking a bit longer than usual.
David J.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2017-06-05 21:02:32 | Re: Re: join estimate of subqueries with range conditions and constraint exclusion | 
| Previous Message | Nikolay Samokhvalov | 2017-06-03 08:37:05 | Re: Monitoring tool for Postgres Database |