Re: Concurrency issue under very heay loads - Mailing list pgsql-performance

From Haszlakiewicz, Eric
Subject Re: Concurrency issue under very heay loads
Date
Msg-id 9D29FD18CBD74A478CBA86E6EF6DBAD403E27B73@CHI4EVS04.corp.transunion.com
Whole thread Raw
In response to Concurrency issue under very heay loads  ("Raji Sridar (raji)" <raji@cisco.com>)
List pgsql-performance
>-----Original Message-----
>From: pgsql-performance-owner@postgresql.org
>
>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.

Are you using "for update" in your select statements?   Are you setting
an appropriate transaction isolation level?

A better way to do this is with a sequence instead.  This is guaranteed
to give you a unique value:
select nextval('address_serial_num_seq');

eric

pgsql-performance by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Calling conventions
Next
From: Krade
Date:
Subject: Full text search with ORDER BY performance issue