Re: SQL MERGE is quite distinct from UPSERT

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: SQL MERGE is quite distinct from UPSERT
Дата
Msg-id 20140720174028.GA13471@svana.org
обсуждение исходный текст
Ответ на SQL MERGE is quite distinct from UPSERT  (Peter Geoghegan <pg@heroku.com>)
Ответы Re: SQL MERGE is quite distinct from UPSERT  (Craig Ringer <craig@2ndquadrant.com>)
Список pgsql-hackers
On Sat, Jul 19, 2014 at 09:55:19PM -0700, Peter Geoghegan wrote:
> At a high level SQL MERGE is quite distinct from UPSERT, in that it is
> a utility command that performs inserts, updates and deletes while
> avoiding race conditions (e.g. unique constraint violations) on a more
> or less best effort basis. MERGE is conceptually messy. In contrast
> UPSERT is actually atomic, and having its behavior be relatively easy
> to reason about ought to be the top priority. There is a *really* big
> demand for UPSERT from users, not MERGE, although MERGE is certainly
> useful too.

FWIW, I agree. MERGE is hard enough as it is, but trying to guarentee
some kind of atomicity makes it nigh on impossible.  Indeed, after
reading what you wrote I think it may well be impossible to make it
atomic *and* make it perform in the general case.

So, +1 UPSERT.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> He who writes carelessly confesses thereby at the very outset that he does
> not attach much importance to his own thoughts.  -- Arthur Schopenhauer

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

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: bad estimation together with large work_mem generates terrible slow hash joins
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg_stat_statements cluttered with "DEALLOCATE dbdpg_p*"