Re: atomic multi-threaded upsert
| От | MIkhail Puzanov |
|---|---|
| Тема | Re: atomic multi-threaded upsert |
| Дата | |
| Msg-id | AANLkTi=_cTvvK=-fmnd1TNemVWUtMacrXJFUjuwrV3BG@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: atomic multi-threaded upsert (Tom Lane <tgl@sss.pgh.pa.us>) |
| Ответы |
Re: atomic multi-threaded upsert
|
| Список | pgsql-sql |
2010/11/25 Tom Lane <tgl@sss.pgh.pa.us>
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.
"Mikhail V. Puzanov" <misha.puzanov@gmail.com> writes:Seems that what you have here is a bad manual implementation of a
> -- increment and get the counter if exists
> UPDATE sequences SET counter = counter + 1
> WHERE section = 'testSection' AND name = 'testKey'
> RETURNING counter;
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 по дате отправления: