From: Joshua Shanks <jjshanks@gmail.com>
To: Gregory Stark <stark@enterprisedb.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Craig Ringer <craig@postnewspapers.com.au>
Cc: pgsql-performance@postgresql.org
Subject: Re: query planner not using the correct index
Date: Thu, 7 Aug 2008 18:04:58 -0500
Message-ID: <84f0acdb0808071604j73992accp1f770c4c7deec5d9@mail.gmail.com> (raw)
In-Reply-To: <874p5wsb74.fsf@oxford.xeocode.com>
References: <84f0acdb0808061435q5ebb607cjc311f1eb4da841a@mail.gmail.com>
<489A623A.4090400@postnewspapers.com.au>
<84f0acdb0808062014p29cf7482ied332225a0a92c63@mail.gmail.com>
<489A6AF5.50908@postnewspapers.com.au>
<84f0acdb0808070811l43a3da9eq240d272f8ddd105c@mail.gmail.com>
<27696.1218143560@sss.pgh.pa.us>
<84f0acdb0808071501n15b0182ga7eca7b1be37d705@mail.gmail.com>
<874p5wsb74.fsf@oxford.xeocode.com>
On Thu, Aug 7, 2008 at 5:38 PM, Gregory Stark <stark@enterprisedb.com> wrote:
> Measuring n_distinct from a sample is inherently difficult and unreliable.
> When 98% of your table falls into those categories it's leaving very few
> chances for the sample to find many other distinct values.
>
> I haven't seen the whole thread, if you haven't tried already you could try
> raising the statistics target for these columns -- that's usually necessary
> anyways when you have a very skewed distribution like this.
>
I did some tweaking on default_statistics_target earlier in the thread
with no luck. I just retried it with default_statistics_target set to
500 and did the VACUUM ANALYZE on the other table this time and
started to see better results and more of the behavior I would expect.
Is there a way to set the stats target for just one column? That seems
like what we might need to do.
> Yeah, Heikki's suggested having a kind of "branch" plan node that knows how
> where the break-point is between two plans and can call the appropriate one.
> We don't have anything like that yet.
>
Is this already on a todo list or is there a bug for it?
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: jjshanks@gmail.com, stark@enterprisedb.com, tgl@sss.pgh.pa.us, craig@postnewspapers.com.au
Subject: Re: query planner not using the correct index
In-Reply-To: <84f0acdb0808071604j73992accp1f770c4c7deec5d9@mail.gmail.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