Multiple inserts

From: Rakesh Kumar <rakeshkumar464(at)outlook(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Multiple inserts
Date: 2016-09-23 12:01:49
Message-ID: DM2PR05MB622C1797FE3F22943234C328CC80@DM2PR05MB622.namprd05.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

I am noticing that if I do this

insert into table values(1,a)
insert into table values(2,b)

insert into table values(3,c)
....
commit after 500 rows
it is lot slower (almost 10x) than
insert into table values((1,a),(2,b),(3,c)) .. upto 500

It is obvious that the gain is due to network trip avoided after every insert.

My question is: Are they any known side-effects or drawbacks of using multiple inserts. I am aware the error checking is much more difficult in the second approach. Any other drawbacks?

thanks

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dorian Hoxha 2016-09-23 13:36:39 Re: Multiple inserts
Previous Message Rafia Sabih 2016-09-23 11:54:32 "Re: Question about grant create on database and pg_dump/pg_dumpall"