Re: Frontend/Backend protocol changes?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jason E(dot) Stewart" <jason(at)openinformatics(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Frontend/Backend protocol changes?
Date: 2002-11-22 17:01:34
Message-ID: 25204.1037984494@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

"Jason E. Stewart" <jason(at)openinformatics(dot)com> 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

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Jason E. Stewart 2002-11-22 17:14:50 Re: Frontend/Backend protocol changes?
Previous Message Jason E. Stewart 2002-11-22 16:37:34 Re: Frontend/Backend protocol changes?