Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C0487475AE6 for ; Fri, 22 Nov 2002 12:01:31 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 2C3EB475AE4 for ; Fri, 22 Nov 2002 12:01:31 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gAMH1YsX025205; Fri, 22 Nov 2002 12:01:35 -0500 (EST) To: "Jason E. Stewart" Cc: pgsql-interfaces@postgresql.org Subject: Re: Frontend/Backend protocol changes? In-reply-to: <87of8ha7ch.fsf@openinformatics.com> References: <87of8ha7ch.fsf@openinformatics.com> Comments: In-reply-to "Jason E. Stewart" message dated "22 Nov 2002 09:37:34 -0700" Date: Fri, 22 Nov 2002 12:01:34 -0500 Message-ID: <25204.1037984494@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/104 X-Sequence-Number: 3352 "Jason E. Stewart" writes: > I've gotten a bit of feedback from the Perl dbi-users list: > 1) Transactions: My current approach was to do this inside a > transaction, but apparently the write-ahead-logging will not handle > 250k logged inserts well. > Is this true, and I should commit after every 20 or so spots? > 2) Indices: apparently every insert updates the indices on the > table. From my reading of the documentation, the indices aren't > updated inside a transaction, but instead at the end. > 3) COPY: I could use COPY, but apparently triggers are not, well, > triggered under COPY. I dunno who the heck you got that advice from, but *none* of those statements are correct, at least not in recent PG releases. You definitely want to do lots of inserts per transaction. There's probably not much further improvement to be had beyond a thousand or so rows per transaction, though. COPY is faster than a series of INSERTs because you bypass the parsing and planning overhead needed for each insert. But my suspicion is that the cycles are actually going into your triggers. What triggers have you got on this table, and what are they doing? regards, tom lane