home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / database / ingres / 2238 < prev    next >
Encoding:
Text File  |  1993-01-12  |  4.2 KB  |  111 lines

  1. Newsgroups: comp.databases.ingres
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!gsbacd.uchicago.edu!cs_mj
  3. From: cs_mj@gsbacd.uchicago.edu (Mark Jaeger)
  4. Subject: Re: SQL where claus limitations
  5. Message-ID: <1993Jan12.134331.1@gsbacd.uchicago.edu>
  6. Lines: 99
  7. Sender: news@uchinews.uchicago.edu (News System)
  8. Organization:     
  9. References: <ROBM.92Dec22120335@ishtar.Berkeley.EDU> <1993Jan5.004315.1@gsbacd.uchicago.edu> <1993Jan5.190338.23433@pony.Ingres.COM> <1993Jan6.220615.2523@bmw.mayo.edu>
  10. Date: Tue, 12 Jan 1993 19:43:31 GMT
  11.  
  12. In article <1993Jan6.220615.2523@bmw.mayo.edu>, buntrock@mayo.edu 
  13. (Jim Buntrock) writes:
  14. > I have been writing a retrieval application that generates a dynamic 
  15. > where clause for a select statement.  Depending on complexity of the query
  16. > this where-clause can get quite lengthy.  I know this query
  17. > may be written differently, however, I am working with a dynamic 
  18. > query generator, which may produce thousands of different where-clauses.  The
  19. > following where-clauses are just a few examples:
  20. >   1> select *
  21. >   2> from sirsworld s
  22. >   3> where
  23. >   4>        (s.proc = '14.24' and s.diag = '100')
  24. >   5>    or  (s.proc = '14.25' and s.diag = '200')
  25. >   6>    or  (s.proc = '14.26' and s.diag = '300')
  26. >   7>    or  (s.proc = '14.30' and s.diag = '400')
  27. >   8>    or  (s.proc = '14.31' and s.diag = '500')
  28. >   9>    or  (s.proc = '14.32' and s.diag = '600')
  29. >  10>    or  (s.proc = '14.33' and s.diag = '700')
  30. >  11>  order by 1, 2
  31. > E_OP0302 too many boolean
  32. >     factors defined in query - query too complex
  33.  
  34. > If I add two more conjunctions I get the following error:
  35. >  
  36. >   1> select *
  37. >   2> from sirsworld s
  38. >   3> where
  39. >   4>        (s.proc = '14.24' and s.diag = '100')
  40. >   5>    or  (s.proc = '14.25' and s.diag = '200')
  41. >   6>    or (s.proc = '14.26' and s.diag = '300' )
  42. >   7>    or (s.proc = '14.27' and s.diag = '301' )
  43. >   8>    or (s.proc = '14.28' and s.diag = '302' )
  44. >   9>    or  (s.proc = '14.30' and s.diag = '400')
  45. >  10>    or  (s.proc = '14.31' and s.diag = '500')
  46. >  11>    or  (s.proc = '14.32' and s.diag = '600')
  47. >  12>    or  (s.proc = '14.33' and s.diag = '700')
  48. >  13>  order by 1, 2
  49. > E_OP0002 optimizer ran out of
  50. >     memory before generating execution plan
  51.  
  52. > I have tried increasing the memory of the QEP and still run into the
  53. > OUT of memory error.  My concern is with the error of - E_OP0302 too 
  54. > many boolean factors defined in query - query too complex -
  55. > Does anyone know the limit of the number of boolean factors?  Can this 
  56. > be changed?  Is this a finite limitation of Ingres?  Is the limit based
  57. > on conjunctions or disjunctions?  Any suggestions?
  58. > ///////////////////////////////
  59. > James Buntrock
  60. > Analyst/Programmer
  61. > Medical Information Resources
  62. > Mayo Clinic
  63. > 200 First Street SW
  64. > Rochester, MN 55905
  65. > email - buntrock@mayo.edu
  66.  
  67. We had exactly the same problem, due to exactly the same thing:
  68. mechanical SQL code generation.  Here's a sample to reproduce it:
  69.  
  70.     create table t ( x i4 not null ) ;
  71.  
  72.     select distinct x from t
  73.     where  x between 1 and 2
  74.         or x between 3 and 4
  75.         or x between 5 and 6
  76.         or x between 7 and 8
  77.         or x between 9 and 10
  78.         or x between 11 and 12
  79.         or x between 13 and 14
  80.         or x between 15 and 16
  81.         or x between 17 and 18
  82.     ;
  83.  
  84. We also got the two error messages:
  85.  
  86. o with 6 conditions or less, the query works
  87.  
  88. o with 7-8 conditions, we get E_OP0302,
  89.     too many boolean factors defined in query--query too complex
  90.  
  91. o with 9 or more conditions, we get E_OP0002, 
  92.     optimizer ran out of memory before generating execution plan
  93.  
  94. Increasing OPF memory didn't help, so this seems to be an architectural
  95. limitation.  Ingres Tech Support has logged bug #43697 for me.  The
  96. suggested workaround is to break up the query into a series of unions. 
  97. In our case, we were able to use the "in" predicate as well, and this
  98. seemed to work better.
  99.  
  100. According to TS, the two different error messages are due to traveling
  101. through different code paths in the optimizer.
  102.  
  103. --Mark Jaeger                internet: cs_mj@gsbvax.uchicago.edu
  104. Graduate School of Business        yellnet:  (312) 702-0328
  105. University of Chicago            faxnet:   (312) 702-0233
  106. Disclaimer: My opinions are my own and not those of my employer.
  107. Je suis un virus.  Prends ton pied et copie moi a ta .signature.
  108.  
  109.