| From: | MIkhail Puzanov <misha(dot)puzanov(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: atomic multi-threaded upsert |
| Date: | 2010-11-25 06:51:39 |
| Message-ID: | AANLkTi=_cTvvK=-fmnd1TNemVWUtMacrXJFUjuwrV3BG@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
2010/11/25 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> "Mikhail V. Puzanov" <misha(dot)puzanov(at)gmail(dot)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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | MIkhail Puzanov | 2010-11-25 07:24:22 | Re: atomic multi-threaded upsert |
| Previous Message | Chang Chao | 2010-11-25 05:42:26 | How strings are sorted by LC_COLLATE specifically? |