Re: Howto use "COPY FROM" with the native API? - Mailing list pgsql-general

From Andy Chambers
Subject Re: Howto use "COPY FROM" with the native API?
Date
Msg-id op.vtsefksacqhz04@vaio.mcnaitdept
Whole thread Raw
In response to Howto use "COPY FROM" with the native API?  (Clemens Eisserer <linuxhippy@gmail.com>)
List pgsql-general
On Mon, 11 Apr 2011 11:21:16 -0400, Clemens Eisserer
<linuxhippy@gmail.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

pgsql-general by date:

Previous
From: Willy-Bas Loos
Date:
Subject: CREATE RULE _copy AS ON COPY TO ...
Next
From: Pavel Stehule
Date:
Subject: Re: Howto use "COPY FROM" with the native API?