On Mon, Apr 23, 2007 at 07:20:29PM +0200, Arkadiusz Raj wrote:
> I have a table in my database that is updated every minute with new acquired
> data. Anyway there is a query to get latest values to be displayed on
> screen. I have postgresql 7.4.2 that work very fine.
You want _at least_ the latest 7.4 version -- ideally, the latest 8.2
version.
> The problem was that
> after hdd crash I have rebuild database from the archive and... Execution
> time of this query starts to be unacceptable.
Have you re-ANALYZEd after the data load?
Anyhow, the issue with the planner not knowing how to estimate expressions
like "now() - interval '5 minutes'" correctly is a known 7.4 issue, and it's
fixed in later versions. It might have worked more or less by accident
earlier, although it seems odd that it wouldn't even have considered the
index scan...
/* Steinar */
--
Homepage: http://www.sesse.net/