Re: Concurrency issue under very heay loads

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Concurrency issue under very heay loads
Date: 2009-07-16 05:34:58
Message-ID: 4A5EBC02.3080403@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance

Raji Sridar (raji) wrote:
> Hi,
>
> We use a typical counter within a transaction to generate order
> sequence number and update the next sequence number. This is a simple
> next counter - nothing fancy about it. When multiple clients are
> concurrently accessing this table and updating it, under extermely
> heavy loads in the system (stress testing), we find that the same
> order number is being generated for multiple clients. Could this be a
> bug? Is there a workaround? Please let me know.

without seeing your code, its hard to say where this bug is, in your
counter implementation, or in postgres. you also don't say what version
of postgres you're using, or even what OS you're running under...

sounds like you should be using a SERIAL (which is implemented as an
INTEGER or BIGINT field with an associated SEQUENCE), as these DO work
just fine under heavy concurrency without any gotchas.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Choi 2009-07-16 05:43:21 How to DB export XML File in PostgreSQL?
Previous Message Greenhorn 2009-07-16 05:30:53 Re: Concurrency issue under very heay loads

Browse pgsql-performance by date

  From Date Subject
Next Message Scott Marlowe 2009-07-16 06:11:20 Re: [PERFORM] Concurrency issue under very heay loads
Previous Message Greenhorn 2009-07-16 05:30:53 Re: Concurrency issue under very heay loads