Re: best performance for simple dml - Mailing list pgsql-sql

From Craig Ringer
Subject Re: best performance for simple dml
Date
Msg-id 4E083920.1070302@postnewspapers.com.au
Whole thread Raw
In response to Re: best performance for simple dml  (Pavel Stehule <pavel.stehule@gmail.com>)
List 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


pgsql-sql by date:

Previous
From: chester c young
Date:
Subject: Re: best performance for simple dml
Next
From: chester c young
Date:
Subject: Re: best performance for simple dml