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 8F42E52D45 for ; Fri, 4 Mar 2005 18:29:04 +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 46046-09 for ; Fri, 4 Mar 2005 18:29:03 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id A07A752D42 for ; Fri, 4 Mar 2005 18:29:02 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j24IT2ic028976; Fri, 4 Mar 2005 13:29:02 -0500 (EST) To: Charles Joseph Cc: pgsql-performance@postgresql.org Subject: Re: Select in FOR LOOP Performance In-reply-to: <20050304175328.92960.qmail@web54301.mail.yahoo.com> References: <20050304175328.92960.qmail@web54301.mail.yahoo.com> Comments: In-reply-to Charles Joseph message dated "Fri, 04 Mar 2005 09:53:28 -0800" Date: Fri, 04 Mar 2005 13:29:02 -0500 Message-ID: <28975.1109960942@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/78 X-Sequence-Number: 10783 Charles Joseph writes: > I face problem when running the following pgplsql > function. The problem is it takes more than 24hours to > complete > the calculation. The EMP table has about 200,000 > records. Sure there are no infinite loops of PARENT links in your table? Also, if CODE is supposed to be unique, you should probably declare its index that way. Or at least make sure the planner knows it's unique (have you ANALYZEd the table lately?) regards, tom lane