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 EF4CB5E46CC for ; Sun, 29 Aug 2004 18:42:38 -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 57651-04 for ; Sun, 29 Aug 2004 21:42:36 +0000 (GMT) Received: from mpls-qmqp-03.inet.qwest.net (mpls-qmqp-03.inet.qwest.net [63.231.195.114]) by svr1.postgresql.org (Postfix) with SMTP id 13F975E46C2 for ; Sun, 29 Aug 2004 18:42:35 -0300 (ADT) Received: (qmail 14319 invoked by uid 0); 29 Aug 2004 21:09:34 -0000 Received: from mpls-pop-07.inet.qwest.net (63.231.195.7) by mpls-qmqp-03.inet.qwest.net with QMQP; 29 Aug 2004 21:09:34 -0000 Received: from 63-227-127-37.dnvr.qwest.net (HELO ?10.0.0.2?) (63.227.127.37) by mpls-pop-07.inet.qwest.net with SMTP; 29 Aug 2004 21:42:37 -0000 Date: Sun, 29 Aug 2004 15:44:15 -0600 Message-Id: <1093815855.5493.33.camel@localhost.localdomain> From: "Scott Marlowe" To: "Greg Stark" Cc: "Jack Kerkhof" , pgsql-performance@postgresql.org Subject: Re: Why does a simple query not use an obvious index? In-Reply-To: <1093815480.5493.29.camel@localhost.localdomain> References: <1093804128.5493.22.camel@localhost.localdomain> <87fz65k5sq.fsf@stark.xeocode.com> <1093815480.5493.29.camel@localhost.localdomain> Content-Type: text/plain Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) 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/431 X-Sequence-Number: 8067 On Sun, 2004-08-29 at 15:38, Scott Marlowe wrote: > On Sun, 2004-08-29 at 15:12, Greg Stark wrote: > > "Scott Marlowe" writes: > > > > > 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: > > > > Huh? I'm curious to know what you're talking about here. > > This has been discussed ad infinitum on the lists in the past. And > explained by better minds than mine, but I'll give it a go. > > PostgreSQL has a "generic" aggregate method. Imagine instead doing a > select count(id1+id2-id3) from table where ... that should be avg(id1+id2-id3)... doh