pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Help with many updates
2+ messages / 2 participants
[nested] [flat]

* Help with many updates
@ 2002-02-21 16:31 Glenn MacGregor <gtm@oracom.com>
  2002-02-21 21:09 ` Re: Help with many updates Oliver Elphick <olly@lfix.co.uk>
  0 siblings, 1 reply; 2+ messages in thread

From: Glenn MacGregor @ 2002-02-21 16:31 UTC (permalink / raw)
  To: pgsql-sql

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

    Thanks




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Help with many updates
  2002-02-21 16:31 Help with many updates Glenn MacGregor <gtm@oracom.com>
@ 2002-02-21 21:09 ` Oliver Elphick <olly@lfix.co.uk>
  0 siblings, 0 replies; 2+ messages in thread

From: Oliver Elphick @ 2002-02-21 21:09 UTC (permalink / raw)
  To: Glenn MacGregor <gtm@oracom.com>; +Cc: pgsql-sql

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 




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-02-21 21:09 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-02-21 16:31 Help with many updates Glenn MacGregor <gtm@oracom.com>
2002-02-21 21:09 ` Oliver Elphick <olly@lfix.co.uk>

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