X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id BD839D1E2FE for ; Sat, 29 Nov 2003 18:02:29 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 36138-07 for ; Sat, 29 Nov 2003 14:02:03 -0400 (AST) Received: from web21404.mail.yahoo.com (web21404.mail.yahoo.com [216.136.232.74]) by svr1.postgresql.org (Postfix) with SMTP id 354CBD1E2F0 for ; Sat, 29 Nov 2003 14:01:53 -0400 (AST) Message-ID: <20031129180159.91794.qmail@web21404.mail.yahoo.com> Received: from [64.81.205.234] by web21404.mail.yahoo.com via HTTP; Sat, 29 Nov 2003 10:01:59 PST Date: Sat, 29 Nov 2003 10:01:59 -0800 (PST) From: ow Subject: Re: Seq Scans when index expected to be used To: Joe Conway , jasiek Cc: ow , pgsql-sql@postgresql.org In-Reply-To: <3FC8D6D3.2030504@joeconway.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/345 X-Sequence-Number: 16160 --- Joe Conway wrote: > > > >>explain select b, c, a > >>from test > >>group by b, c, a > >>having count(*) > 1 > > Why would you expect this to use an index scan when it needs to read the > entire table? If you read the whole table (or even a significant > fraction of it), a seq scan is faster. My impression was that the index "I_bca" covers the query, hence there should not be a need to go to the table itself. Why would it? P.S. explain analyze vs explain. Normally, would've used "explain analyze" but in this case it's taking way too long so I used "explain". Thanks __________________________________ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/