Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 4517C475932 for ; Thu, 27 Jun 2002 19:43:10 -0400 (EDT) Mailbox-Line: From keith@heart.com.au Thu Jun 27 19:43:10 2002 Received: from gateway.heart.com.au (unknown [202.44.184.121]) by postgresql.org (Postfix) with ESMTP id 5FAD547587E for ; Thu, 27 Jun 2002 19:43:07 -0400 (EDT) Received: from tardis.heart.com.au (IDENT:root@tardis.heart.com.au [192.168.0.42]) by gateway.heart.com.au (8.11.6/8.11.2) with ESMTP id g5S01A310891; Fri, 28 Jun 2002 10:01:42 +1000 Received: from heart.com.au ([192.168.0.53]) by tardis.heart.com.au (8.9.3/8.8.7) with ESMTP id JAA28640; Fri, 28 Jun 2002 09:41:10 +1000 Message-ID: <3D1BA27E.9000802@heart.com.au> Date: Fri, 28 Jun 2002 09:40:46 +1000 From: Keith Gray User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4.1) Gecko/20020508 Netscape6/6.2.3 X-Accept-Language: en-us MIME-Version: 1.0 To: Masaru Sugawara Cc: Alvar Freude , pgsql-sql@postgresql.org Subject: Re: 2 Selects 1 is faster, why? References: <1371510000.1025105687@gnarzelwicht.delirium-arts.de> <20020627234531.7ECB.RK73@sea.plala.or.jp> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-0.1 required=5.0 tests=SUBJ_ENDS_IN_Q_MARK version=2.30 X-Spam-Level: X-Archive-Number: 200206/376 X-Sequence-Number: 8341 Masaru Sugawara wrote: > > You are right. And this type of optimising are not yet implemented. > Tom said it in the prior discussions. > ...but is it true that if you place the filter clause first, the join will not have to complete the whole table? eg. SELECT item.description, stock.available FROM item, stock WHERE item.itemid = '1234' AND item.itemid=stock.itemid; ...would be more efficient than, SELECT item.description, stock.available FROM item, stock WHERE item.itemid=stock.itemid AND item.itemid = '1234'; -- Keith Gray Technical Services Manager Heart Consulting Services P/L mailto:keith@heart.com.au