Re: batch inserts in python & libpq

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: batch inserts in python & libpq
Date: 2009-08-07 13:55:20
Message-ID: 20090807135520.GF5407@samason.me.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Aug 07, 2009 at 01:37:08PM +0000, Scara Maccai wrote:
> using Java I'm able to get a 10000 inserts/sec on our server using
> batch updates (using preparedStatement.addBatch()).

I'd probably generate SQL that looks somewhat like the following:

UPDATE foo f SET v = x.v
FROM (VALUES (1,'hi'), (2,'bye')) x(i,v)
WHERE f.id = x.i;

The "best" solution depends on the details of the problem though!

--
Sam http://samason.me.uk/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Mead 2009-08-07 13:56:22 Re: using the schema in postbooks
Previous Message Adrian Klaver 2009-08-07 13:52:26 Re: using the schema in postbooks