Insert Or update

From: Anton Nikiforov <anton(at)nikiforov(dot)ru>
To: postgres list <pgsql-general(at)postgresql(dot)org>
Subject: Insert Or update
Date: 2004-04-23 13:48:21
Message-ID: 40891EA5.9090504@nikiforov.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear All,
I have a database which stores traffic data and to update the traffic
for the particular IP i have to select this ip from the table for this
period and if it is already in the database i should run an update
statement, but if it is not presented - i should insert the data. It was
OK when i have had 2-3 millions of records, but now it is 15 millions
and i'm not complaining that it is too slow to select - no, but it takes
some time anyway.
I know that this will be helpful to write a function that will do this
for me, but it will run the same time as my insertion tool that is
written in c or even slower. So my question is: is it possible to have
"UPDATE OR INSERT" statement in the PostgreSQL like it is possible in
Oracle (as i heard but did not check it by myself yet)?

Best regards,
Anton

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stijn Vanroye 2004-04-23 13:54:52 Re: Question about inserts
Previous Message Paul Thomas 2004-04-23 12:44:10 Re: Question about inserts