Re: Optimizer generates bad plans.

From: Kris Jurka <books(at)ejurka(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Optimizer generates bad plans.
Date: 2002-09-20 18:45:46
Message-ID: Pine.LNX.4.33.0209201440090.25412-100000@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 19 Sep 2002, Kris Jurka wrote:
>
> On Thu, 19 Sep 2002, Tom Lane wrote:
>
> > Kris Jurka <jurka(at)ejurka(dot)com> writes:
> > > While adding schema support to the JDBC Driver, I came across a query
> > > which occasionally generates some spectacularly bad plans.
> >
> > Hm, does an ANALYZE help?
> >
>
> Yes, it does, but I don't understand why. The query is entirely against
> pg_catalog tables which have had all of three tables added to them. How
> can the new ANALYZE stats be significantly different than what came from
> the ANALYZED template1.
>
> Kris Jurka
>

Looking at the differences in statistics before and after the ANALYZE the
only differences are in correlation. This comes from initdb around line
1046...

"$PGPATH"/postgres $PGSQL_OPT template1 >/dev/null <<EOF
ANALYZE;
VACUUM FULL FREEZE;
EOF

Could this be done better in the one step VACUUM FULL FREEZE ANALYZE or
ANALYZING after the VACUUM FULL?

Kris Jurka

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2002-09-20 19:24:00 Re: [PATCHES] to_char(FM9.9) bug fix
Previous Message Joe Conway 2002-09-20 18:28:15 Re: Improving speed of copy