X-Original-To: pgsql-general@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3429747580B for ; Mon, 12 May 2003 10:01:53 -0400 (EDT) Received: from secure.tritus.ca (baxter.tritus.ca [209.47.166.15]) by postgresql.org (Postfix) with ESMTP id 103C847621C for ; Mon, 12 May 2003 10:01:48 -0400 (EDT) Received: from [10.200.200.129] (CPE00045ae165bc-CM014320108734.cpe.net.cable.rogers.com [::ffff:24.157.7.10]) (AUTH: CRAM-MD5 adam@tritus.ca, TLS: TLSv1/SSLv3, 168bits, DES-CBC3-SHA) by secure.tritus.ca with esmtp; Mon, 12 May 2003 10:01:48 -0400 Date: Mon, 12 May 2003 09:57:12 -0400 From: Adam Sherman To: pgsql-general@postgresql.org Subject: Performance Problem Message-ID: <62900000.1052747832@saturn> X-Mailer: Mulberry/3.0.3 (Linux/x86) X-OpenPGP: 82C7 7288 650F 8F77 2FFB C170 3698 125A 79C3 FC80 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Spam-Status: No, hits=-6.6 required=5.0 tests=BAYES_01 version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/349 X-Sequence-Number: 42004 I am trying to isolate a performance problem I'm having. I have some code that does something like this, iterating through a list: BEGIN while(list) lookup for existing entry (SELECT) if not, INSERT if yes, UPDATE log a message COMMIT With approx. 30K items the process takes way too long. On the order of 10+ minutes. I notice that the process seems to slow down as it completes more and more items. ie, the first 10K takes just a few moments while the last 10K takes most of the time. Note that I'm running test where the only existing entries will have been inserted in the same transaction. I need to know if the bottleneck is PG or higher up so I can go hunting there. Thanks, A. -- Adam Sherman Tritus CG Inc. http://www.tritus.ca/ +1 (613) 797-6819