Re: Any idea for serializing INSERTING SERIAL column?

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: schmiddy(at)gmail(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Any idea for serializing INSERTING SERIAL column?
Date: 2011-06-01 02:52:58
Message-ID: 20110601.115258.513173085122133724.t-ishii@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Tue, May 31, 2011 at 8:08 PM, Tatsuo Ishii <ishii(at)postgresql(dot)org> wrote:
> [snip]
>> In summary,
>>
>> 1) "LOCK table foo" cannot be used because of conflict with autovacuum
>> 2) "LOCK sequence" just doesn't work
>> 3) "SELECT 1 FROM LOCK sequece" fails after XID wraparound
>>
>> If you have other idea to serialize concurrent INSERT to a table, I
>> would like to hear from you.
>
> Sorry, I'm not real familiar with pgpool, but have you thought about
> using an advisory lock on the target table, instead of a "real" lock
> (SELECT ... FOR UPDATE / LOCK table)? An advisory lock should not
> interfere with autovacuum. Obviously, this would only work if all the
> INSERTs in your example were coming from a single application (i.e.
> pgpool) which would honor the advisory lock.

Problem with the advisory lock is, it will not work if the target
table is empty.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-06-01 02:53:47 Re: [BUGS] BUG #6046: select current_date crashes postgres
Previous Message Josh Kupershmidt 2011-06-01 01:48:51 Re: Any idea for serializing INSERTING SERIAL column?