On Tue, Jun 26, 2001 at 10:04:15AM -0700, kenneth wrote:
>
> If your database provides sequences, use them. There are several problems with
> using 'random' numbers:
>
> 1. How random are the numbers? It's possible to get a synonym, at which point
> you've got to catch the db error and start all over.
You have a point. If my random number sequence loops around without
having visited all numbers in the value space at least once, I have a
serious problem.
> 2. A sophisticated database will optimize it's use of a disk, especially a
> SCSI disk, and lay records down in such a way that the heads insert/read
> sequential data very efficiently. 'Random' keys will checkerboard your data.
Why would this matter? Do databases assume that records with primary
keys "near" one another will often be used together?
> Keys should meet two criteria. Unique, and sequential.
>
> What if your db doesn't provide sequences? If you can guarantee that you'll
> only run in a single jvm, append a static counter to the end of the time stamp
If I remember correctly, modifying statics is a big no-no in EJBs?
>
> If you're going to run in multiple jvm's, the solution is a counter
> table. Lock the counter table when you update the count. This doesn't perform
> as bad as it sounds.
Which would leave this alternative of course. It somehow seems like
overkill to me, but it may very well be the option I land on.
Thanks for the input.
Cheers
Bent D
--
Bent Dalager - [EMAIL PROTECTED] - http://www.pvv.org/~bcd
powered by emacs
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user