Re: query plan worse after analyze

From: Jeff Frost <jeff(at)frostconsultingllc(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "'PostgreSQL Performance'" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: query plan worse after analyze
Date: 2007-10-06 06:41:05
Message-ID: Pine.LNX.4.64.0710052329150.4620@discord.home.frostconsultingllc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Sat, 6 Oct 2007, Tom Lane wrote:

> "Jeff Frost" <jeff(at)frostconsultingllc(dot)com> writes:
>> Before analyze it seems to choose Bitmap Heap Scan on episodes
>> current_episode, but after it chooses Index Scan Backward using
>> index_episodes_on_publish_on on episodes current_episode.
>
> Have you tried raising the stats target for "episodes"? Seems like
> the problem is a misestimate of the frequency of matches for
> season_id = something.

Can you set the stats target for an entire table up?

I tried this:

ALTER TABLE episodes ALTER COLUMN season_id SET STATISTICS 1000;

and got the same plan.

And since I had this on a test server, I set the default stats target
up to 100, reran analyze and got the same plan.

Same if I up it to 1000. :-(

--
Jeff Frost, Owner <jeff(at)frostconsultingllc(dot)com>
Frost Consulting, LLC http://www.frostconsultingllc.com/
Phone: 650-780-7908 FAX: 650-649-1954

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Alvaro Herrera 2007-10-06 15:11:15 Re: query plan worse after analyze
Previous Message Tom Lane 2007-10-06 05:50:03 Re: query plan worse after analyze