Re: Concurrency issue under very heay loads

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>-----Original Message-----
>From: pgsql-performance-owner@xxxxxxxxxxxxxx 
> 
>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

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux