Strategies to use Database Sequences?

Posted by Bruno Brant on Stack Overflow See other posts from Stack Overflow or by Bruno Brant
Published on 2010-04-14T15:03:09Z Indexed on 2010/04/14 16:03 UTC
Read the original article Hit count: 410

Filed under:
|

Hello all,

I have a high-end architecture which receives many requests every second (in fact, it can receive many requests every millisecond). The architecture is designed so that some controls rely on a certain unique id assigned to each request.

To create such UID we use a DB2 Sequence. Right now I already understand that this approach is flawed, since using the database is costly, but it makes sense to do so because this value will also be used to log information on the database.

My team has just found out an increase of almost 1000% in elapsed time for each transaction, which we are assuming happened because of the sequence. Now I wonder, using sequences will serialize access to my application? Since they have to guarantee that increments works the way they should, they have to, right?

So, are there better strategies when using sequences? Please assume that I have no other way of obtaining a unique id other than relying on the database.

© Stack Overflow or respective owner

Related posts about databases

Related posts about parallel