home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / database / theory / 461 < prev    next >
Encoding:
Text File  |  1992-09-09  |  1.6 KB  |  46 lines

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