From: Tom Lane <tgl@sss.pgh.pa.us>
To: Good, Thomas <tgood@svcmcny.org>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: Question about slow queries...
Date: Thu, 27 May 2010 10:03:28 -0400
Message-ID: <14435.1274969008@sss.pgh.pa.us> (raw)
In-Reply-To: <FA041D403EDFCD4397E1F6382360ECFCC2979966F3@SVCMCEMAIL.svcmc.svcmcny.org>
References: <FA041D403EDFCD4397E1F6382360ECFCC2979966F3@SVCMCEMAIL.svcmc.svcmcny.org>
"Good, Thomas" <tgood@svcmcny.org> writes:
> I have a question about a query that starts out fine and over time slows to a halt - but only on a webhosted site. Locally it does fine.
> The query is a singleton select (no joins), hitting a table with about
> 5,000 records in it. Over time the query slows to a crawl and I have to
> dump and rebuild/repopulate to restore efficiency. Vacuum does nothing
> but a dump and reload fixes the problem and the query runs lightning
> fast again -- for a period of a week or so.
If a dump and reload fixes it then you have table-bloat or index-bloat
problems. A simple VACUUM won't fix that once it's happened. You need
to VACUUM more often so that it doesn't get bloated in the first place.
> Locally I'm running 8.4.2, the webhost is 8.1.18
... and the reason for the difference is probably that 8.4.x has a
reasonably decent autovacuum facility, which 8.1.x does not. Suggest
bugging your webhost provider to provide a less obsolete version of
Postgres.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, tgood@svcmcny.org
Subject: Re: Question about slow queries...
In-Reply-To: <14435.1274969008@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox