X-Original-To: pgsql-performance@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 8070B926039 for ; Sat, 31 May 2003 13:02:23 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 98943-07 for ; Sat, 31 May 2003 13:02:12 -0400 (EDT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by developer.postgresql.org (Postfix) with ESMTP id 2CA1F925FF7 for ; Sat, 31 May 2003 13:02:10 -0400 (EDT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19M9k9-0002Up-00 for ; Sat, 31 May 2003 13:02:09 -0400 Received: by dba2 (Postfix, from userid 1019) id 452C3D1BB; Sat, 31 May 2003 13:02:08 -0400 (EDT) Date: Sat, 31 May 2003 13:02:08 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: why Sequencial Scan when selecting on primary key of table? Message-ID: <20030531170205.GD22469@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <20030531080716.20944.h004.c001.wm@mail.dilger.cc.criticalpath.net> <004301c32791$f983c710$01000001@trouble> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <004301c32791$f983c710$01000001@trouble> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/298 X-Sequence-Number: 2077 On Sat, May 31, 2003 at 12:30:40PM -0400, Brian Tarbox wrote: > I have a simple table with a dozen integer fields and a primary key. > > When I say "explain select * from Patient where Patient_primary_key = 100" > > I get sequential scan. > > I've just converted my application from MySQL and am seeing everything run > about 3X slower. What do I have to do to get postgres to use indexes? Usual questions: have you vacuumed? EXPLAIN ANALYSE output, schema, &c. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110