Re: atomic multi-threaded upsert - Mailing list pgsql-sql

From MIkhail Puzanov
Subject Re: atomic multi-threaded upsert
Date
Msg-id AANLkTi=_cTvvK=-fmnd1TNemVWUtMacrXJFUjuwrV3BG@mail.gmail.com
Whole thread Raw
In response to Re: atomic multi-threaded upsert  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: atomic multi-threaded upsert  ("Mikhail V. Puzanov" <misha.puzanov@gmail.com>)
List pgsql-sql


2010/11/25 Tom Lane <tgl@sss.pgh.pa.us>
"Mikhail V. Puzanov" <misha.puzanov@gmail.com> writes:
>    -- increment and get the counter if exists
>   UPDATE sequences SET counter = counter + 1
>   WHERE section = 'testSection' AND name = 'testKey'
>   RETURNING counter;

Seems that what you have here is a bad manual implementation of a
sequence.  Why don't you use a real sequence object and nextval()?



Well, if I use the real sequence, I'll need unpredictable number of them
and will have to store mapping (section, name)->sequenceName, and
also will have to create those sequences dynamically the similar way.

pgsql-sql by date:

Previous
From: KM
Date:
Subject: Re: atomic multi-threaded upsert
Next
From: MIkhail Puzanov
Date:
Subject: Re: atomic multi-threaded upsert