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 29F9452C34 for ; Thu, 14 Jul 2005 08:20:58 -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 58844-06 for ; Thu, 14 Jul 2005 11:20:53 +0000 (GMT) Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) by svr1.postgresql.org (Postfix) with ESMTP id 659A952A42 for ; Thu, 14 Jul 2005 08:20:49 -0300 (ADT) Received: from adsl7-104-140.du.simnet.is ([85.220.100.140] [85.220.100.140]) by quasar.skima.is with ESMTP; Thu, 14 Jul 2005 11:20:26 Z Subject: Re: Slow Query From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= To: Marc McIntyre Cc: pgsql-performance@postgresql.org In-Reply-To: <42D5AC8A.9000003@squiz.net> References: <42D5AC8A.9000003@squiz.net> Content-Type: text/plain Date: Thu, 14 Jul 2005 11:22:33 +0000 Message-Id: <1121340153.31360.22.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/174 X-Sequence-Number: 13415 On Thu, 2005-07-14 at 10:06 +1000, Marc McIntyre wrote: > I'm having a problem with a query that performs a sequential scan on a > table when it should be performing an index scan. The interesting thing > is, when we dumped the database on another server, it performed an index > scan on that server. ... > The EXPLAIN ANALYZE from the system performing an sequential scan: > > QUERY PLAN > Sort (cost=30079.79..30079.89 rows=42 width=113) (actual time=39889.989..39890.346 rows=260 loops=1) ... > The EXPLAIN ANALYZE from the system performing an index scan scan: > Sort (cost=16873.64..16873.74 rows=40 width=113) (actual time=2169.905..2169.912 rows=13 loops=1) looks like the first query is returning 260 rows, but the second one 13 this may not be your problem, but are you sure you are using the same query on the same data here ? gnari