X-Original-To: pgsql-performance@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3CFF74758C9 for ; Mon, 28 Apr 2003 06:41:55 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 595F3474E42 for ; Mon, 28 Apr 2003 06:41:53 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id h3SAfsU09457 for ; Mon, 28 Apr 2003 16:11:54 +0530 Received: from daithan.intranet.pspl.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id h3SAfsx09452 for ; Mon, 28 Apr 2003 16:11:54 +0530 From: Shridhar Daithankar To: Subject: Re: Diferent execution plan for similar query Date: Mon, 28 Apr 2003 16:11:33 +0530 User-Agent: KMail/1.5.1 References: <003401c30d70$92c07310$8001010a@sipec.es> In-Reply-To: <003401c30d70$92c07310$8001010a@sipec.es> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200304281611.33669.shridhar_daithankar@nospam.persistent.co.in> X-Spam-Status: No, hits=-38.9 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_KMAIL autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/226 X-Sequence-Number: 1732 On Monday 28 April 2003 15:56, jgimenez@sipec_quitaesto_.es wrote: > Somebody could explain me why this query... > > SELECT * > FROM articulos,eans > WHERE articulos.id_iinterno=eans.id_iinterno > AND eans.id_iean=345 > > is slower than this one? (the difference is the quotes around the > number....) > > SELECT * > FROM articulos,eans > WHERE articulos.id_iinterno=eans.id_iinterno > AND eans.id_iean='345' In second case, postgresql typecasted it correctly. Even eans.id_iean=345::int8 would have worked the same way. By default postgresql treats a number as int4 while comparing and integer and float8 for a real numbe. I discovered that yesterday. Until the planner/parser gets smarter, this is going to be an FAQ.. Shridhar