On Wed, 2009-04-22 at 21:53 +0100, James Mansion wrote:
> Stephen Frost wrote:
> > You're re-hashing things I've already said. The big win is batching the
> > inserts, however that's done, into fewer transactions. Sure, multi-row
> > inserts could be used to do that, but so could dropping begin/commits in
> > right now which probably takes even less effort.
> >
> Well, I think you are seriously underestimating the cost of the
> round-trip compared
The breakdown is this:
1. Eliminate single inserts
2. Eliminate round trips
Yes round trips are hugely expensive.
>
> > No, as was pointed out previously already, you really just need 2. A
> >
> And I'm disagreeing with that. Single row is a given, but I think
> you'll find it pays to have one
My experience shows that you are correct. Even if you do a single BEGIN;
with 1000 inserts you are still getting a round trip for every insert
until you commit. Based on 20ms round trip time, you are talking
20seconds additional overhead.
Joshua D. Drake
--
PostgreSQL - XMPP: jdrake@jabber.postgresql.org
Consulting, Development, Support, Training
503-667-4564 - http://www.commandprompt.com/
The PostgreSQL Company, serving since 1997