From: Josh Berkus <josh@agliodbs.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Matthew Bellew <matthewb@labkey.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Query optimizer plans with very small selectivity estimates
Date: Thu, 29 Oct 2015 17:00:07 -0700
Message-ID: <5632B307.2000905@agliodbs.com> (raw)
In-Reply-To: <WM!95d34f36067699671425e41d616c3a97fe0916654a7eb703c4479c7cdd6443a6db3ceab221939b9b11725cebf286ec35!@asav-3.01.com>
References: <CAJnjrPOziOSDWCUgfb1U9QUGdfLFspF6AZ9Xj=x5cOBhyqDFyA@mail.gmail.com>
<2141.1446143047@sss.pgh.pa.us>
<WM!95d34f36067699671425e41d616c3a97fe0916654a7eb703c4479c7cdd6443a6db3ceab221939b9b11725cebf286ec35!@asav-3.01.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
On 10/29/2015 11:24 AM, Tom Lane wrote:
> Matthew Bellew <matthewb@labkey.com> writes:
>> I made have several users encounter performance problems, which all
>> seem to come down to this problem: multiplying selectivity estimates can
>> cause tuple estimates to grow very small very quickly, once the estimator
>> gets to 1 row, the planner may choose plans that are very good ONLY WHEN
>> there is exactly 1 row (maybe even O(N^large)). Unfortunately, these may
>> be the worst plans if the estimate is even slightly off (even just
>> returning 2 or 3 rows versus 1).
>
> Yeah, this is a well-known problem. There has been prior discussion along
> the same lines as you mention (only believe 1-row estimates when it's
> provably true that there's at most one row), but it hasn't looked like an
> easy change. See the pgsql-hackers archives for previous threads.
Also see Tomas's correlated stats patch submitted for 9.6.
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
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: josh@agliodbs.com, tgl@sss.pgh.pa.us, matthewb@labkey.com
Subject: Re: Query optimizer plans with very small selectivity estimates
In-Reply-To: <5632B307.2000905@agliodbs.com>
* 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