Re: Is it possible to make a streaming replication faster using COPY instead of lots of INSERTS? - Mailing list pgsql-general

From Sergey Konoplev
Subject Re: Is it possible to make a streaming replication faster using COPY instead of lots of INSERTS?
Date
Msg-id CAL_0b1uqpZFBvairfF54k-WESMac_Xhm03g_r=XO122s5k6KsQ@mail.gmail.com
Whole thread Raw
In response to Re: Is it possible to make a streaming replication faster using COPY instead of lots of INSERTS?  (David Johnston <polobo@yahoo.com>)
List pgsql-general
On 1 December 2011 04:00, David Johnston <polobo@yahoo.com> wrote:
> On Nov 30, 2011, at 18:44, Craig Ringer <ringerc@ringerc.id.au> wrote:
>
>> On 11/30/2011 10:32 PM, Sergey Konoplev wrote:
> Insert into tbl values(...); [times 50]
> insert into tbl values (...), (...), (...), ...; [ once with 50 values ]
> Copy [ with 50 input rows provided ]
>
> I would presume the first one is badly performing but no idea whether the multi-value version of insert would be
outperformedby an equivalent Copy command (both on the main query and during replication) 
>
> Though, does auto-commit affect the results in the first case; I.e., without auto-commit do the first two results
replicateequivalently? 

So the guaranteed solutions are either

BEGIN;
INSERT INTO table1 VALUES (...), (...), ...;
COMMIT;

or

COPY FROM ...;

correct?

>
>>
> David J



--
Sergey Konoplev

Blog: http://gray-hemp.blogspot.com
LinkedIn: http://ru.linkedin.com/in/grayhemp
JID/GTalk: gray.ru@gmail.com Skype: gray-hemp

pgsql-general by date:

Previous
From: Sergey Konoplev
Date:
Subject: Re: Is it possible to make a streaming replication faster using COPY instead of lots of INSERTS?
Next
From: Tomas Vondra
Date:
Subject: Re: Limiting number of connections to PostgreSQL per IP (not per DB/user)?