Re: Question on Insert / Update

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Question on Insert / Update
Date: 2005-11-09 15:20:51
Message-ID: 20051109152051.GS30305@webserv.wug-glas.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

am 10.11.2005, um 1:45:46 +1100 mailte Alex folgendes:
> Hi,
> have just a general question...
>
> I have a table of 10M records, unique key on 5 fields.
> I need to update/insert 200k records in one go.
>
> I could do a select to check for existence and then either insert or
> update.
> Or simply insert, check on the error code an update if required.

Take a look at
http://developer.postgresql.org/docs/postgres/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING

HTH, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47212, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Keith C. Perry 2005-11-09 15:25:53 Re: clustering by partial indexes
Previous Message Tom Lane 2005-11-09 15:20:28 Re: insert on duplicate update?