X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id EDE00474E42 for ; Wed, 23 Apr 2003 16:14:10 -0400 (EDT) Received: from rtlocal.trade-india.com (mail-relay.trade-india.com [203.196.129.235]) by postgresql.org (Postfix) with SMTP id 9BE49475ADE for ; Wed, 23 Apr 2003 16:13:36 -0400 (EDT) Received: (qmail 20420 invoked from network); 23 Apr 2003 20:13:35 -0000 Received: from unknown (HELO www.trade-india.com) (unknown) by unknown with SMTP; 23 Apr 2003 20:13:35 -0000 Received: (qmail 14649 invoked by uid 99); 23 Apr 2003 20:13:29 -0000 Received: from 219.65.253.85 (SquirrelMail authenticated user mallah) by mail.trade-india.com with HTTP; Thu, 24 Apr 2003 01:43:29 +0530 (IST) Message-ID: <1386.219.65.253.85.1051128809.squirrel@mail.trade-india.com> Date: Thu, 24 Apr 2003 01:43:29 +0530 (IST) Subject: Re: Why is seq search preferred here by planner? From: To: In-Reply-To: <200304231253.52051.josh@agliodbs.com> References: <1220.219.65.235.51.1051114881.squirrel@mail.trade-india.com> <200304231120.56699.josh@agliodbs.com> <1331.219.65.233.8.1051123905.squirrel@mail.trade-india.com> <200304231253.52051.josh@agliodbs.com> X-Priority: 3 Importance: Normal X-MSMail-Priority: Normal Cc: , X-Mailer: SquirrelMail (version 1.2.6) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, hits=-25.5 required=5.0 tests=BAYES_01,IN_REP_TO,MISSING_MIMEOLE,MISSING_OUTLOOK_NAME, NO_REAL_NAME,QUOTED_EMAIL_TEXT,QUOTE_TWICE_1,REFERENCES, REPLY_WITH_QUOTES 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/352 X-Sequence-Number: 13053 > Mallah, > >> > The reason that the planner is using a seq scan on > personal_account_details is the same as the >> > reason for using a seq scan on email_bank; the number of rows which > match the condition, >> > about 150,000. With that many qualifying rows, a seq scan is faster. >> >> >> But there are two tables here , email_bank and personal_account_details = in personal account >> details only one row is supposed to match a given userid as userid is th= e PKEY , why seq_scan >> there ? or am i getting the explain > wrong ? > > It doesn't matter whether it's a primary key or not. If your query or s= ubquery condition > returns a large number/proportion of rows, a seq scan is going to be fas= ter than an index > scan. > > As far as userid being a key, this affects the planner's *join method*, *= not* how the database > gets the rows. Got it , you mean to say userid being pkey is affecting the method of implicit join being made by the update stmt. thanks once again. Regds mallah. > > > -- > -Josh Berkus > Aglio Database Solutions > San Francisco ----------------------------------------- Get your free web based email at trade-india.com. "India's Leading B2B eMarketplace.!" http://www.trade-india.com/