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 AE08E92595B for ; Sat, 31 May 2003 13:13:58 -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 06259-09 for ; Sat, 31 May 2003 13:13:48 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by developer.postgresql.org (Postfix) with ESMTP id EB2D5925953 for ; Sat, 31 May 2003 13:13:47 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h4VHDlU6021074; Sat, 31 May 2003 13:13:47 -0400 (EDT) To: "Brian Tarbox" Cc: pgsql-performance@postgresql.org Subject: Re: why Sequencial Scan when selecting on primary key of table? In-reply-to: <004301c32791$f983c710$01000001@trouble> References: <004301c32791$f983c710$01000001@trouble> Comments: In-reply-to "Brian Tarbox" message dated "Sat, 31 May 2003 12:30:40 -0400" Date: Sat, 31 May 2003 13:13:47 -0400 Message-ID: <21073.1054401227@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/299 X-Sequence-Number: 2078 "Brian Tarbox" writes: > When I say "explain select * from Patient where Patient_primary_key = 100" > I get sequential scan. Perhaps Patient_primary_key is not an integer field? If not, you need to cast the constant 100 to the right type. Or write '100' with single quotes around it, which leaves Postgres to choose the constant's datatype. (Yeah, I know, it's a pain in the neck. We've had a lot of discussions about how to fix this without breaking datatype extensibility; no luck so far.) regards, tom lane