Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id BBB449FB40A for ; Mon, 23 Apr 2007 15:19:56 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 95573-10 for ; Mon, 23 Apr 2007 15:19:51 -0300 (ADT) X-Greylist: delayed 00:21:26.90066 by SQLgrey-1.7.4 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id CF0F99FB410 for ; Mon, 23 Apr 2007 15:19:52 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr4.postgresql.org (Postfix) with ESMTP id 1AD215AF031 for ; Mon, 23 Apr 2007 17:58:24 +0000 (GMT) Received: from trofast.ipv6.sesse.net ([2001:700:300:1803:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1Hg2nr-0002yf-Hu; Mon, 23 Apr 2007 19:58:21 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1Hg2nk-0002qd-00; Mon, 23 Apr 2007 19:58:12 +0200 Date: Mon, 23 Apr 2007 19:58:11 +0200 From: "Steinar H. Gunderson" To: Arkadiusz Raj Cc: pgsql-performance@postgresql.org Subject: Re: index usage Message-ID: <20070423175811.GA10915@uio.no> Mail-Followup-To: Arkadiusz Raj , pgsql-performance@postgresql.org References: <20070423172018.6409A79B@post17.futuro.info.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20070423172018.6409A79B@post17.futuro.info.pl> X-Operating-System: Linux 2.6.20.4 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.063 tagged_above=0 required=5 tests=AWL=0.062, BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200704/395 X-Sequence-Number: 24272 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/