home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases.theory
- Path: sparky!uunet!dscares!neptune!cdk
- From: cdk@neptune.dsc.com (Colin Kelley)
- Subject: Re: ordered collections
- Message-ID: <cdk.716057364@neptune>
- Sender: news@dscares
- Nntp-Posting-Host: neptune.dsc.com
- Organization: Digital Sound Corporation
- References: <cdk.715362552@neptune> <DAVIDM.92Sep2112813@consilium.com>
- Date: Wed, 9 Sep 1992 16:49:24 GMT
- Lines: 33
-
- davidm@consilium.com (David S. Masterson) writes:
-
- >>>>>> On 1 Sep 92 15:49:12 GMT, cdk@neptune.dsc.com (Colin Kelley) said:
-
- >> Is there a standard way to implement ordered collections in a relational
- >> database that would allow for random insertion? You could always have a
- >> sequence number field to remember the ordering, but if you want random
- >> insertion, you may run out of bits in this sequence number and not be able
- >> to insert a new entry between two others.
-
- >Well, I don't think there is a standard, but here's one way.
-
- >1. Make the primary key be (sequence_number, current_date).
- >2. Generate a new sequence_number for additions to the end of the collection.
- >3. Insertion anywhere else uses the sequence_number of preceding item.
-
- I'm confused. Suppose my collection has entries with these (sequence_number,
- current_date) keys:
-
- (1, 10 Sept 1992 1:00:00)
- (2, 10 Sept 1992 2:00:00)
- (2, 10 Sept 1992 3:00:00)
- (2, 10 Sept 1992 4:00:00)
- (3, 10 Sept 1992 5:00:00)
-
- and at 6:00:00 I want to insert a new entry between the second and third. It
- sounds to me like your algorithm would choose key (2, 10 Sept 1992 6:00:00),
- thus forcing me to add the new entry between the fourth and fifth.
-
- Am I missing something?
-
- -Colin
- --
-