Re: Stupidity or sequences?
From: Hans Forbrich <fuzzy.graybeard_at_gmail.com>
Date: Fri, 12 Apr 2013 10:00:33 -0600
Message-ID: <51682FA1.9060506_at_gmail.com>
On 12/04/2013 9:24 AM, Johan Eriksson wrote:
> Hi all,
> I think most of us has seen someone trying to be smart or trying to gain
> database independencies by not using oracle sequence but instead roll their
> own system by using a table, and a row for each "sequence".
> Almost every attempt on this I yet have seen has been plagued with row lock
> contention or other concurrencies, scalability zero...
<rant>
The basic question is whether you can use a sequence or whether you need a serial number.
Date: Fri, 12 Apr 2013 10:00:33 -0600
Message-ID: <51682FA1.9060506_at_gmail.com>
On 12/04/2013 9:24 AM, Johan Eriksson wrote:
> Hi all,
> I think most of us has seen someone trying to be smart or trying to gain
> database independencies by not using oracle sequence but instead roll their
> own system by using a table, and a row for each "sequence".
> Almost every attempt on this I yet have seen has been plagued with row lock
> contention or other concurrencies, scalability zero...
<rant>
The basic question is whether you can use a sequence or whether you need a serial number.
Sequences provide a light-weight, [almost] guaranteed unique number, but it is not a serial number.
If you need a serial number, you probably need to enforce serialization.
Serialization is fundamentally about locking to ensure 'one at a time'. "Concurrency in a serial environment" becomes the oxymoron in that discussion - if you want to support a concurrent environment with minimal impact, you need to lift some of the constraints, such as "no gaps".
The basic problem, therefore comes down to understanding the question: "What is that number actually supposed to do for the business."
Once that is understood, you can look at a number of alternatives to fulfilling that need.
Knuth rules!
</rant>
/Hans
-- http://www.freelists.org/webpage/oracle-lReceived on Fri Apr 12 2013 - 18:00:33 CEST