Re: Suboptimal plan choice problem with 8.3RC2

From: "Guillaume Smet" <guillaume(dot)smet(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers list" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Suboptimal plan choice problem with 8.3RC2
Date: 2008-01-22 19:48:49
Message-ID: 1d4e0c10801221148u242b5786s3a9f54965b5e0972@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jan 22, 2008 8:28 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> The only way the merge join could have an estimated cost that's barely
> 1% of the estimate for one of its inputs is if the planner thinks the
> merge will stop after reading only 1% of that input, ie, the largest
> a.numasso value is only about 1% of the way through the range of
> el.numasso. If the a.numasso distribution has a long tail, you might
> need to raise the statistics target to fix this estimate.

The statistics target was fine (I set it to 30 by default). But...

> I'd expect 8.1 to make about the same estimate given the same stats,
> so I think it's not looking at the same stats.

Yep, the statistics were the problem, sorry for the noise. The query
performs in 50ms after an ANALYZE so far better than with 8.1.

The 8.3RC2 box is using the default configuration of autovacuum
though. Shouldn't it take care of keeping the statistics up to date?
That's what I thought from what I've read on autovacuum so far (it's
the first time I use it in "production" though, it was a manual
process until now) - and that's why I didn't check it. Or should we
still run the first ANALYZE manually?

Andrew from Supernews also pointed the lack of an index on
evelieu(numasso). It's even better with it (less than a ms).

--
Guillaume

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2008-01-22 19:53:59 Re: autonomous transactions
Previous Message Tom Lane 2008-01-22 19:28:19 Re: Suboptimal plan choice problem with 8.3RC2