Re: Query performance - Mailing list pgsql-performance

From Erwin Brandstetter
Subject Re: Query performance
Date
Msg-id ed80d$447a1c8c$506d0da5$19172@news.chello.at
Whole thread Raw
In response to Query performance  ("Lou O'Quin" <loquin@talleyds.com>)
List pgsql-performance
Antonio Batovanja wrote:
> Laurenz Albe wrote:
>
>> Antonio Batovanja wrote:
>>> I'm having trouble understanding, why a specific query on a small
>>> database is taking so long...
>>>
>> Before I try to understand the execution plans:
>>
>> Have you run ANALYZE on the tables involved before you ran the query?
>
> Hi,
>
> Just to be on the safe side, I've run ANALYZE now.
> Here are the query plans for the two queries:

I suspect a misunderstanding here. What Laurenz probably meant is to run
  analyze on the involved _tables_ so the statistics data is refreshed.
If the query planner runs with outdated statistics, queries may perform
very poorly. Try

    vacuum full analyze yourdatabase

To fully vacuum your database and analyze all tables.
(vacuum full is extra, but can't hurt.)

http://www.postgresql.org/docs/8.1/static/sql-vacuum.html
http://www.postgresql.org/docs/8.1/static/sql-analyze.html

Regards, Erwin

pgsql-performance by date:

Previous
From: Erwin Brandstetter
Date:
Subject: Re: Query performance
Next
From: Anthony Ransley
Date:
Subject: Split select completes, single select doesn't and becomes IO bound!