home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / database / 6102 < prev    next >
Encoding:
Internet Message Format  |  1992-08-13  |  4.1 KB

  1. Xref: sparky comp.databases:6102 comp.databases.theory:360
  2. Path: sparky!uunet!decwrl!oracle!unrepliable!bounce
  3. Newsgroups: comp.databases,comp.databases.theory
  4. From: mfriedma@uucp (Michael Friedman)
  5. Subject: Re: Relational Queues
  6. Message-ID: <1992Aug13.195729.19884@oracle.us.oracle.com>
  7. Sender: usenet@oracle.us.oracle.com (Oracle News Poster)
  8. Nntp-Posting-Host: appseq
  9. Organization: Oracle Corporation
  10. References: <BsKzHw.9sy@world.std.com> <1992Aug7.200632.22867@oracle.us.oracle.com> <1992Aug12.113531.4654@mp.cs.niu.edu>
  11. Date: Thu, 13 Aug 1992 19:57:29 GMT
  12. X-Disclaimer: This message was written by an unauthenticated user
  13.               at Oracle Corporation.  The opinions expressed are those
  14.               of the user and not necessarily those of Oracle.
  15. Lines: 72
  16.  
  17. In article <1992Aug12.113531.4654@mp.cs.niu.edu> higgins@mp.cs.niu.edu (Greg Higgins) writes:
  18. >In article <1992Aug7.200632.22867@oracle.us.oracle.com> mfriedma@uucp (Michael Friedman) writes:
  19. >>In article <BsKzHw.9sy@world.std.com> edwards@world.std.com (Jonathan Edwards) writes:
  20. >>>How do you implement a standard FIFO queue in the relational model?
  21.  
  22. >>>Here's the rules: multiple producers, multiple consumers. No possibility of
  23. >>>two consumers getting the same record. Ability for consumer to wait if the
  24. >>>queue is empty (no polling allowed!). Strict FIFO, but to make it a little
  25. >>>easier, I only ask that a record enqueued by one transaction come before all
  26. >>>records enqueued by other transactions that START after the first one COMMITS.
  27.  
  28. >>>I believe that this can only be done by setting up a central server program,
  29. >>>called from the producers and consumers (perhaps via RPC), which serializes
  30. >>>access to the relation representing the queue. If this is true, doesn't anyone
  31. >>>else find this a rather glaring weakness?
  32.  
  33. >>The SQL standard supports sequences.  Just create an increasing
  34. >>sequence and use it to number each item you add to the table.  Then
  35. >>when you pop items off, just select where SEQ_NUMBER = MAX(select
  36. >>seq_number from table).  
  37.  
  38. >Hardly. This implements a LIFO queue.
  39.  
  40. Sorry.  Momentary attack of braindeadness.  Just replace MAX with MIN.
  41.  
  42. >>In general, however, this wouldn't even be a weakness if we didn't
  43. >>have a solution.
  44.  
  45. >>SQL is intended to solve real world problems, not comp sci questions.
  46. >>If you don't have the information in your database to know which item
  47. >>in your list should be dealt with next then either you didn't design
  48. >>your database right or it doesn't matter which comes next.
  49.  
  50. >Wanting a FIFO queue is not just a comp sci problem. It is a real world
  51. >problem, and one which application developers need to deal with frequently.
  52.  
  53. >Consider a help desk situation where you have a first line tech support
  54. >screening calls, entering them into the database, and then putting the
  55. >folks who need more help on hold for second level support. 
  56.  
  57. >You want second level support to pick up those call in the correct order.
  58.  
  59. >Note that the correct order may not be the serial number, since presumably
  60. >that would be the initial entry into the database by the first line support.
  61.  
  62. So what is the correct order?  Probably it's the order in which they
  63. were put on hold for second level support.  So how would I handle that
  64. if I didn't have sequences?  Hmm.  Well, would a timestamp do?  Yup.
  65. And if you don't have a time stamp you didn't design the database
  66. right.
  67.  
  68. SQL has its limitations (explosion of parts, for one) but this isn't
  69. one of them.
  70.  
  71. >>I am not an official Oracle spokesman.  I speak for myself and no one else.
  72.  
  73. >I'll bet Oracle Corp. is glad of that. You should consider  
  74. >solving the problem instead of criticizing the presenter
  75. >and maybe that will change.
  76.  
  77. Yow!!!!  Actually, even reading over my original post, I didn't think
  78. it was in any way mean.  As far as criticizing the presenter goes, I
  79. think that for posts like this, where someone is debating an issue, as
  80. opposed to asking "I need help" it is acceptable to post
  81. counterarguments.  I guess some people consider that to be criticizing
  82. the presenter.  I don't.
  83.  
  84. Mike
  85.  
  86. -- 
  87. -------------------------------------------------------------------------------
  88. I am not an official Oracle spokesman.  I speak for myself and no one else.
  89.