Re: Query performance

From: Erwin Brandstetter <brsaweda(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Query performance
Date: 2006-05-28 21:56:27
Message-ID: ed80d$447a1c8c$506d0da5$19172@news.chello.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-performance by date

  From Date Subject
Next Message Erwin Brandstetter 2006-05-28 22:38:55 Re: Query performance
Previous Message Tom Lane 2006-05-28 21:32:19 Re: App very unresponsive while performing simple update