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 6F76D925FFC for ; Sat, 31 May 2003 13:43:19 -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 10565-03 for ; Sat, 31 May 2003 13:43:08 -0400 (EDT) Received: from TheWorld.com (pcls2.std.com [199.172.62.104]) by developer.postgresql.org (Postfix) with ESMTP id BBE2A926023 for ; Sat, 31 May 2003 13:43:07 -0400 (EDT) Received: from trouble (pool-151-203-197-57.bos.east.verizon.net [151.203.197.57]) by TheWorld.com (8.12.8p1/8.12.8) with SMTP id h4VHgrRX029921; Sat, 31 May 2003 13:43:05 -0400 From: "Brian Tarbox" To: "Tom Lane" Cc: Subject: Re: why Sequencial Scan when selecting on primary key of table? Date: Sat, 31 May 2003 13:45:50 -0400 Message-ID: <000001c3279c$79dc2d80$01000001@trouble> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <21073.1054401227@sss.pgh.pa.us> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/300 X-Sequence-Number: 2079 The primary key field is an integer and I have performed vacuum analyse but that does not seem to change anything. I've also heard that postgres will not indexes when JOINing tables. Can that really be true?? Brian -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Tom Lane Sent: Saturday, May 31, 2003 1:14 PM To: Brian Tarbox Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] why Sequencial Scan when selecting on primary key of table? "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 ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org