From: E.Havelaar@Regy.Canterbury.Ac.NZ (Ed Havelaar)
Subject: Re: Generating unique numbers, etc.
Date: 1995/12/14 [thread overview]
Message-ID: <4aq3kt$nia@cantua.canterbury.ac.nz> (raw)
In-Reply-To: 4aic03$3u1@cantua.canterbury.ac.nz
I've had a fair number of responses to my request below, and since not many of
them seem to have turned up in the newsgroups, I thought I'd post a quick
summary (and another question).
First my question:
Suppose I have a program that takes ages to run and keeps a read-only
transaction open for its duration (e.g. to perform calculations on all 100000
records in a table), Every now and again, I want to assign an account number.
This involves starting a read-write transaction for as short a time as
possible. How can I do this without terminating my hours-long
read-only transaction and somehow figuring out where and how to recommence it?
Now my original question, and a bit of a summary.
>
>We have an RdB database on top of VAX VMS (soon to migrate to Alpha) for
which
>I need to generate a unique account number whenever I create a new record. I
>wonder if anyone has any experience on what the best way to do this is.
The general consensus seems to be:
(1) Triggers would work, sort of. This doesn't really tell me what code to
put in the trigger though -- I understand triggers are just a way of
automatically executing some code on (say) an insert operation, so it would be
handy for ODBC clients. I got the impression from a number of people that
triggers are not overly fast, and we're looking at a peak load of about 400
inserts per hour, so I doubt this is the way to go.
(2) Getting Max(Acc_No)+1 from a table is too slow.
(3) Better to store the next available number in a table of its own, and have
each application lock and increment it when it needs a new one. A few
suggested the "Jerry Leichter" approach of splitting the available numbers
into blocks with one record governing assignments from each block, and then
using some random number to figure out which record to lock. We probably
don't have enough load to justify bothering with the added complexity.
(4) Nobody seemed to think there was any great advantage in using RMS files.
______________________________________________________________________
Eduard E Havelaar | The fool says in his heart,
Information Services Section | "there is no God"...
University of Canterbury |
Christchurch, New Zealand | - Psalm 14:1
next prev parent reply other threads:[~1995-12-14 5:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-12-11 5:00 Generating unique numbers Ed Havelaar
1995-12-12 5:00 ` Lilian Hobbs
1995-12-14 5:00 ` Albert Godfrind
1995-12-13 5:00 ` Stephen Hoffman
1995-12-14 5:00 ` Ed Havelaar [this message]
1995-12-14 5:00 ` Generating unique numbers, etc Norm Lastovica
1995-12-15 5:00 ` Lilian Hobbs
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox