X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CE2123A55D6 for ; Mon, 6 Dec 2004 15:52:57 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74819-06 for ; Mon, 6 Dec 2004 15:52:48 +0000 (GMT) Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) by svr1.postgresql.org (Postfix) with ESMTP id 781F23A5F74 for ; Mon, 6 Dec 2004 15:52:51 +0000 (GMT) Received: from deg.cc (kyle.deg.cc [198.70.16.205]) by mail.deg.cc (Postfix) with ESMTP id 85A3156100; Mon, 6 Dec 2004 10:52:49 -0500 (EST) Message-ID: <41B48053.7090805@deg.cc> Date: Mon, 06 Dec 2004 10:52:51 -0500 From: Pallav Kalva User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040308 X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= Cc: pgsql-performance@postgresql.org Subject: Re: Poor Query References: <41B47A97.1090708@deg.cc> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200412/112 X-Sequence-Number: 9487 Pierre-Frédéric Caillaud wrote: > > How many rows do the following queries return : > > select userID > from bankaccount ba > where ba.bankaccountID = u.bankaccountID > and ba.accountnumber = '12345678' > > select userID > from bankaccount ba > where ba.bankaccountID = u.bankaccountID > and ba.routingNumber = '12345678' > > Can you post EXPLAIN ANALYZE for these two queries ? > Regards. > Thanks! for the quick reply. It should usually return just one account for that user so its only one record. Actually userid column doesnt exist on bankaccount table it exists only on the user table and it is joined with bankaccountid column, if i run this query separately i wouldnt able to run it .