X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 769145E46C3 for ; Mon, 30 Aug 2004 16:32:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14689-07 for ; Mon, 30 Aug 2004 19:32:00 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 214C15E46F3 for ; Mon, 30 Aug 2004 16:31:59 -0300 (ADT) Received: (qmail 1879 invoked by uid 500); 30 Aug 2004 19:40:50 -0000 Date: Mon, 30 Aug 2004 14:40:50 -0500 From: Bruno Wolff III To: =?iso-8859-1?Q?Pierre-Fr=E9d=E9ric?= Caillaud Cc: pgsql-performance@postgresql.org Subject: Re: Why does a simple query not use an obvious index? Message-ID: <20040830194050.GA1862@wolff.to> Mail-Followup-To: =?iso-8859-1?Q?Pierre-Fr=E9d=E9ric?= Caillaud , pgsql-performance@postgresql.org References: <1093804128.5493.22.camel@localhost.localdomain> <87fz65k5sq.fsf@stark.xeocode.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/455 X-Sequence-Number: 8091 On Mon, Aug 30, 2004 at 21:21:26 +0200, Pierre-Frédéric Caillaud wrote: > >>Also, count(*) is likely to always generate a seq scan due to the way > >>aggregates are implemented currently in pgsql. you might want to try: > > > By the way, in an ideal world, count(*) should only read the index > on the timetamp column, not the rows. I guess this is not the case. Would > this be an useful optimization ? It's in the archives. The short answer is that no, postgres has to check the heap to check tuple visibility to the current transaction.