Re: best performance for simple dml

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: chester c young <chestercyoung(at)yahoo(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: best performance for simple dml
Date: 2011-06-27 08:02:40
Message-ID: 4E083920.1070302@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 27/06/11 15:05, Pavel Stehule wrote:

> exec('begin');
> for(i = 0; i < 1000; i++)
> exec("insert into foo values($1), itoa(i));
> exec('commit');

You can probably also benefit from multi-valued INSERTs, though I
haven't verified this.

INSERT INTO foo VALUES
(1,'joe','dean'),
(4,'fred','bob'),
(11,'anne','smith');

There'll be a threshhold above which the COPY protocol becomes faster,
though.

--
Craig Ringer

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message chester c young 2011-06-27 13:02:44 Re: best performance for simple dml
Previous Message chester c young 2011-06-27 07:49:49 Re: best performance for simple dml