pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@postnewspapers.com.au>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: chester c young <chestercyoung@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: best performance for simple dml
Date: Mon, 27 Jun 2011 16:02:40 +0800
Message-ID: <4E083920.1070302@postnewspapers.com.au> (raw)
In-Reply-To: <BANLkTik90qDGv-9CcHtV6i=abynywUkbNA@mail.gmail.com>
References: <BANLkTimcokKM=MTAu1-kZFPsNGW8Lgj3rw@mail.gmail.com>
	<576786.8402.qm@web161422.mail.bf1.yahoo.com>
	<BANLkTik90qDGv-9CcHtV6i=abynywUkbNA@mail.gmail.com>

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



view thread (8+ messages)  latest in thread

Message-ID: <4E083920.1070302@postnewspapers.com.au>
Permalink:  ../4E083920.1070302@postnewspapers.com.au/
Also on:    postgresql.org/message-id/4E083920.1070302@postnewspapers.com.au

 · 

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-sql@postgresql.org
  Cc: craig@postnewspapers.com.au, pavel.stehule@gmail.com, chestercyoung@yahoo.com
  Subject: Re: best performance for simple dml
  In-Reply-To: <4E083920.1070302@postnewspapers.com.au>

* 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