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 1FDB35E46C2 for ; Sun, 29 Aug 2004 19:18:22 -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 65182-07 for ; Sun, 29 Aug 2004 22:18:19 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3FFD65E46E7 for ; Sun, 29 Aug 2004 19:18:18 -0300 (ADT) Received: from [134.22.70.99] (dyn-70-99.tor.dsl.tht.net [134.22.70.99]) by tht.net (Postfix) with ESMTP id 40D4B76A34; Sun, 29 Aug 2004 18:18:25 -0400 (EDT) Subject: Re: Why does a simple query not use an obvious index? From: Rod Taylor To: Greg Stark Cc: Scott Marlowe , Jack Kerkhof , Postgresql Performance In-Reply-To: <874qmlk342.fsf@stark.xeocode.com> References: <1093804128.5493.22.camel@localhost.localdomain> <87fz65k5sq.fsf@stark.xeocode.com> <1093815480.5493.29.camel@localhost.localdomain> <874qmlk342.fsf@stark.xeocode.com> Content-Type: text/plain Message-Id: <1093817899.42199.63.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Sun, 29 Aug 2004 18:18:20 -0400 Content-Transfer-Encoding: 7bit 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/435 X-Sequence-Number: 8071 > People expect count(*) _without a where clause_ to be cached in a single > global variable. Postgres can't do this, but the reason has everything to do Someone should write an approx_count('table') function that reads reltuples from pg_class and tell them to use it in combination with autovac. I've yet to see someone use count(*) across a table and not round the result themselves (approx 9 million clients).