X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id A7608D1B947; Fri, 5 Sep 2003 16:09:51 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 51002-07; Fri, 5 Sep 2003 13:09:20 -0300 (ADT) Received: from lakemtao01.cox.net (lakemtao01.cox.net [68.1.17.244]) by svr1.postgresql.org (Postfix) with ESMTP id 6A054D1B56B; Fri, 5 Sep 2003 13:09:19 -0300 (ADT) Received: from lhosts ([68.11.66.83]) by lakemtao01.cox.net (InterMail vM.5.01.06.04 201-253-122-130-104-20030726) with ESMTP id <20030905160917.RBKV722.lakemtao01.cox.net@lhosts>; Fri, 5 Sep 2003 12:09:17 -0400 Subject: Re: [PERFORM] Seq scan of table? From: Ron Johnson To: PgSQL General ML , PgSQL Performance ML In-Reply-To: References: Content-Type: text/plain Message-Id: <1062778158.17023.205.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Fri, 05 Sep 2003 11:09:18 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/456 X-Sequence-Number: 48678 On Fri, 2003-09-05 at 09:39, Jonathan Bartlett wrote: > > I think I have found out why.. I have a where clause on a ID field but it > > seems like I need to cast this integer to the same integer as the field is > > defined in the table, else it will do a tablescan. > > Yes, this is correct > > > Is this assumtion correct? And if it is, do I then need to change all my > > sql's to cast the where clause where I just have a number (eg where field > > = 1) to force the planner to use index scan instead of seq scan? > > Someone correct me if I'm wrong, but I believe numbers are int4's, so they > need to be cast if your column is not an int4. You mean "constant" scalars? Yes, constants scalars are interpreted as int4. -- ----------------------------------------------------------------- Ron Johnson, Jr. ron.l.johnson@cox.net Jefferson, LA USA "Millions of Chinese speak Chinese, and it's not hereditary..." Dr. Dean Edell