Re: Why is unique constraint needed for upsert? (treat atomicity as optional) - Mailing list pgsql-general

From David G Johnston
Subject Re: Why is unique constraint needed for upsert? (treat atomicity as optional)
Date
Msg-id 1406150492812-5812628.post@n5.nabble.com
Whole thread Raw
In response to Re: Why is unique constraint needed for upsert? (treat atomicity as optional)  (Seamus Abshere <seamus@abshere.net>)
List pgsql-general
seamusabshere wrote
>> At READ COMMITTED isolation level, you should always get an atomic insert
>> or update [1]
>
> I just think there are a lot of non-concurrent bulk loading and
> processing workflows that could benefit from the performance advantages
> of upsert (one trip to database).

Bulk load raw data into UNLOGGED staging table
LOCK production table
UPDATE matched records
INSERT unmatched records
UNLOCK production table
TRUNCATE staging table

This seems like it would be sufficient for "non-concurrent bulk loading"...

David J.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Why-is-unique-constraint-needed-for-upsert-tp5812552p5812628.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


pgsql-general by date:

Previous
From: Seamus Abshere
Date:
Subject: Re: Why is unique constraint needed for upsert? (treat atomicity as optional)
Next
From: David G Johnston
Date:
Subject: Re: Why is unique constraint needed for upsert? (treat atomicity as optional)