Search Postgresql Archives

Re: Why is unique constraint needed for upsert?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----Original Message-----
From: pgsql-general-owner@xxxxxxxxxxxxxx [mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of John R Pierce
Sent: Wednesday, July 23, 2014 1:32 PM
To: pgsql-general@xxxxxxxxxxxxxx
Subject: Re: [GENERAL] Why is unique constraint needed for upsert?

On 7/23/2014 10:21 AM, Seamus Abshere wrote:
> hi all,
>
> Upsert is usually defined [1] in reference to a violating a unique key:
>
>> Insert, if unique constraint violation then update; or update, if not 
>> found then insert.
>
> Is this theoretically preferable to just looking for a row that 
> matches certain criteria, updating it if found or inserting otherwise?

what happens when two connections do this more or less concurrently, in transactions?



-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast


Well, that's exactly why OP prefers Mongo, which doesn't care about such "small" things as ACID.

Regards,
Igor Neyman

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux