X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1190ED9A85 for ; Thu, 20 Oct 2005 05:39:57 -0300 (ADT) 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 46815-03 for ; Thu, 20 Oct 2005 08:39:52 +0000 (GMT) Received: from mailer.eglobalreach.net (mail.padalacentral.com [202.124.128.22]) by svr1.postgresql.org (Postfix) with ESMTP id 5AFF8D6F4A for ; Thu, 20 Oct 2005 05:39:52 -0300 (ADT) Received: from ghwk02002147 (localhost [127.0.0.1] (may be forged)) by mailer.eglobalreach.net (8.11.6p2/) with ESMTP id j9K8dPT11484 for ; Thu, 20 Oct 2005 16:39:25 +0800 From: "Christian Paul B. Cosinas" To: Subject: Deleting Records Date: Thu, 20 Oct 2005 08:43:34 -0000 Message-ID: <002701c5d552$5bc7ea30$1e21100a@ghwk02002147> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <16F953410A0F1346848DCB476A989CFE01D557@swtexchange2.technology.de> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 Thread-Index: AcXUYc4J45L1KvnPROegqnDqsT3t0AA48ZRAAAMDDdA= X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.679 required=5 tests=[FORGED_RCVD_HELO=0.05, URIBL_SBL=0.629] X-Spam-Level: X-Archive-Number: 200510/275 X-Sequence-Number: 15043 Hi! I'm experiencing a very slow deletion of records. Which I thin is not right. I have a Dual Xeon Server with 6gig Memory. I am only deleting about 22,000 records but it took me more than 1 hour to finish this. What could possibly I do so that I can make this fast? Here is the code inside my function: FOR temp_rec IN SELECT * FROM item_qc_doer LOOP DELETE FROM qc_session WHERE item_id = temp_rec.item_id; DELETE FROM item_qc_doer WHERE item_id = temp_rec.item_id; END LOOP; Item_qc_oder table contains 22,000 records. I choose Polesoft Lockspam to fight spam, and you? http://www.polesoft.com/refer.html