how do I update or insert efficently in postgres

Поиск
Список
Период
Сортировка
От marc@oscar.eng.cv.net (Marc Spitzer)
Тема how do I update or insert efficently in postgres
Дата
Msg-id slrn9v2ouq.30qa.marc@oscar.eng.cv.net
обсуждение исходный текст
Ответы Re: how do I update or insert efficently in postgres  ("Josh Berkus" <josh@agliodbs.com>)
Re: how do I update or insert efficently in postgres  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
I need to do the follwoing logic for a db I am building:

if row exists update some fields 
else insert all fields

I have come across this befor and have used select to drive the
choice, if I could get the row update else insert.  The db I worked on
had a few thousand rows so it was fast enough.  This table will have
around 1 million rows to start out with and I was wondering if there
was any way to do this better.  I am touching each row twice and would
like to get that down to once if possable.  If that is not possable
would it be better to move the whole thing inside of 1 explicit
transaction?  Any other ideas I have missed?  

Thank you 

marc


В списке pgsql-sql по дате отправления:

Предыдущее
От: Robert Sundström
Дата:
Сообщение: Re: SQL99
Следующее
От: "guard"
Дата:
Сообщение: postgresql 7.2beta can't support "distributed databases "