pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ron Mayer <rm_pg@cheapcomplexdevices.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Multiple insert performance trick or performance misunderstanding?
Date: Sat, 24 Sep 2005 17:15:41 -0400
Message-ID: <23702.1127596541@sss.pgh.pa.us> (raw)
In-Reply-To: <dh4e88$25qe$1@news.hub.org>
References: <dh4e88$25qe$1@news.hub.org>

Ron Mayer <rm_pg@cheapcomplexdevices.com> writes:
> Is it expected that I'd be better off sending big
> concatenated strings like
>    "insert into tbl (c1,c2) values (v1,v2);insert into tbl (c1,c2) values (v3,v4);..."
> instead of sending them one at a time?

It's certainly possible, if the network round trip from client to server
is slow.  I do not think offhand that there is any material advantage
for the processing within the server (assuming you've wrapped the whole
thing into one transaction in both cases); if anything, the
concatenated-statement case is probably a bit worse inside the server
because it will transiently eat more memory.  But network latency or
client-side per-command overhead could well cause the results you see.

			regards, tom lane



view thread (2+ messages)

Message-ID: <23702.1127596541@sss.pgh.pa.us>
Permalink:  ../23702.1127596541@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23702.1127596541@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, rm_pg@cheapcomplexdevices.com
  Subject: Re: Multiple insert performance trick or performance misunderstanding?
  In-Reply-To: <23702.1127596541@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox