pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Elphick <olly@lfix.co.uk>
To: Glenn MacGregor <gtm@oracom.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Help with many updates
Date: 21 Feb 2002 21:09:42 +0000
Message-ID: <1014325782.3217.823.camel@linda> (raw)
In-Reply-To: <006901c1baf5$3bce6360$4d00a8c0@catamount>
References: <006901c1baf5$3bce6360$4d00a8c0@catamount>

On Thu, 2002-02-21 at 16:31, Glenn MacGregor wrote:
> What is the preferred way to do many updates.  Right now I am just doing
> each row at a time, is there a better way?  I have about 1000 or so and it
> takes a good 45 seconds

If you are currently doing:

   INSERT...
   INSERT...

you can speed it up by enclosing the whole lot in a single transaction:

   BEGIN
   INSERT...
   INSERT...
   COMMIT

You can get it even faster by formatting the input data in a text file
and using the COPY command (not in a transaction).

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C

     "My sheep hear my voice, and I know them, and they 
      follow me; And I give unto them eternal life; and they
      shall never perish, neither shall any man pluck them 
      out of my hand."          John 10:27,28 




view thread (2+ messages)

Message-ID: <1014325782.3217.823.camel@linda>
Permalink:  ../1014325782.3217.823.camel@linda/
Also on:    postgresql.org/message-id/1014325782.3217.823.camel@linda

 · 

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: olly@lfix.co.uk, gtm@oracom.com
  Subject: Re: Help with many updates
  In-Reply-To: <1014325782.3217.823.camel@linda>

* 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