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 A17BB3A5F99 for ; Mon, 6 Dec 2004 16:38:01 +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 92016-06 for ; Mon, 6 Dec 2004 16:37:55 +0000 (GMT) Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) by svr1.postgresql.org (Postfix) with ESMTP id 0C8513A5FA0 for ; Mon, 6 Dec 2004 16:37:53 +0000 (GMT) Received: from deg.cc (kyle.deg.cc [198.70.16.205]) by mail.deg.cc (Postfix) with ESMTP id CCDAC56338; Mon, 6 Dec 2004 11:37:45 -0500 (EST) Message-ID: <41B48ADB.7000100@deg.cc> Date: Mon, 06 Dec 2004 11:37:47 -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> <41B48053.7090805@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/115 X-Sequence-Number: 9490 Pierre-Frédéric Caillaud wrote: > > > Just wanted to know the selectivity of the accountnumber and > routingNumber columns. > I shoulda written : > >>> How many rows do the following queries return : >> > One or few at most, or a lot ? Just One, user can i have only one bankaccount. > >>> >>> select userID >>> from bankaccount >>> WHERE accountnumber = '12345678' >>> >>> select userID >>> from bankaccount >>> WHERE 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 . >> >> > > >