Re: Howto use "COPY FROM" with the native API?

From: "Andy Chambers" <achambers(at)mcna(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Howto use "COPY FROM" with the native API?
Date: 2011-04-11 18:46:22
Message-ID: op.vtsefksacqhz04@vaio.mcnaitdept
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 11 Apr 2011 11:21:16 -0400, Clemens Eisserer
<linuxhippy(at)gmail(dot)com> wrote:

> Hi,
>
> We are working on an university project for network traffic accounting.
> We use ulogd-2 to log netfilter packets, however it creates for each
> packet a seperate transaction and also doesn't use prepared
> statements, which results in horrible performance.
>
> What we are looking for is a low-overhead way of inserting many rows
> (100-1000) into a table at once in one transaction.
> Is "COPY FROM STDIN" a good idea in this case?

For that many, you can probably get away with

insert into foo values
(1, 2, 3),
(4, 5, 6)

..rather than having to figure out the "COPY FROM" API.

Cheers,
Andy

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2011-04-11 19:33:14 Re: Howto use "COPY FROM" with the native API?
Previous Message Willy-Bas Loos 2011-04-11 18:26:40 CREATE RULE _copy AS ON COPY TO ...