Re: vacuum analyze slows sql query

From: Greg Stark <gsstark(at)mit(dot)edu>
To: patrick ~ <sidsrr(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: vacuum analyze slows sql query
Date: 2004-11-03 19:20:32
Message-ID: 87breepwn3.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


patrick ~ <sidsrr(at)yahoo(dot)com> writes:

> I noticed that a freshly created db with freshly inserted data (from
> a previous pg_dump) would result in quite fast results. However,
> after running 'vacuum analyze' the very same query slowed down about
> 1250x (Time: 1080688.921 ms vs Time: 864.522 ms).

If it gets slower immediately after a single vacuum analyze then the problem
is that one of the queries is getting planned wrong when stats are available.
If it takes a while to slow down then it could be other problems such as index
bloat etc.

Don't use "explain verbose" use "explain analyze". I don't know if it was in
7.1 but you say you reproduced the problem with 7.4. It would be helpful to
see the results of "explain analyze select ..." on the query before and after
the vacuum analyze.

--
greg

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message stuff 2004-11-03 20:06:00 oracle v$session equivalent in postgresql
Previous Message Andrew Sullivan 2004-11-03 18:45:47 Re: vacuum analyze slows sql query