Search Postgresql Archives

Re: On duplicate ignore

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

 



* Scott Marlowe:

> On Thu, Jan 19, 2012 at 7:54 AM, Florian Weimer <fweimer@xxxxxx> wrote:
>> * Gnanakumar:
>>
>>>> Just create a unique index on EMAIL column and handle error if it comes
>>>
>>> Thanks for your suggestion.  Of course, I do understand that this could be
>>> enforced/imposed at the database-level at any time.  But I'm trying to find
>>> out whether this could be solved at the application layer itself.  Any
>>> thoughts/ideas?
>>
>> If you use serializable transactions in PostgreSQL 9.1, you can
>> implement such constraints in the application without additional
>> locking.  However, with concurrent writes and without an index, the rate
>> of detected serialization violations and resulting transactions aborts
>> will be high.
>
> No, you sadly can't.  PostgreSQL doesn't yet support proper predicate
> locking to allow the application to be sure that the OP's original
> statement, and ones like it, don't have a race condition.  A unique
> index is the only way to be sure.

Huh?  This was one of the major new features in PostgreSQL 9.1.

-- 
Florian Weimer                <fweimer@xxxxxx>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[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