On Sun, Aug 31, 2014 at 6:10 AM, Peter Eisentraut <pete...@gmx.net> wrote:

> On 8/30/14 2:26 AM, Jeff Janes wrote:
> > But there cases were people use COPY in a loop with a small amount of
> > data in each statement.
>
> What would be the reason for doing that?
>
>
As far as I can tell, DRY.  They need code to do bulk inserts anyway.  So,
just use that everywhere even when it is not in bulk.

Also, you can't interleave a copy command with other queries on the same
connection.  So you code it to start a COPY, use it until you discover you
need to run a query (because you encounter something not in you local
cache), end the COPY and do that query, then restart the query.

Under some conditions, the interruption occurs very seldom, under other
conditions it is pretty much every row.

Cheers,

Jeff

Reply via email to