home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / database / informix / 2678 < prev    next >
Encoding:
Text File  |  1992-12-12  |  1.7 KB  |  50 lines

  1. Newsgroups: comp.databases.informix
  2. Path: sparky!uunet!enterpoop.mit.edu!eff!world!sglines
  3. From: sglines@world.std.com (steve glines)
  4. Subject: Re: Two index query optimization problem
  5. Message-ID: <Bz5AHr.5B6@world.std.com>
  6. Organization: The World Public Access UNIX, Brookline, MA
  7. References: <1992Dec12.000653.7004@anasaz>
  8. Distribution: usa
  9. Date: Sat, 12 Dec 1992 11:56:14 GMT
  10. Lines: 38
  11.  
  12. In article <1992Dec12.000653.7004@anasaz> devin@anasaz (Devin Wala) writes:
  13. >
  14. >
  15. >There are two indexes on the table:
  16. >
  17. >   index1: unique index on A, B;
  18. >   index2: unique index on C, D, A, B;
  19. >
  20. >The problem I'm having is that I can't run a query with A and B mentioned
  21. >in the WHERE clause that will use index2.  I suspect that the optimizer
  22. >is looking at the query and saying; hey, I got A, I got B, I've got a unique
  23. >index1 on both A and B.  Look no further, I am set dudes and dudettes, and 
  24. >I am outta here! (optimizers talk like that you know).
  25. >
  26. >This would be fine if my queries were of the form:  
  27. >
  28. >   WHERE C=value AND D=value A=value AND B=value; 
  29. >   
  30. >However, one of my queries is of the form:
  31. >
  32. >   WHERE C=value AND D=value A>value AND B=value; 
  33. >
  34. >so it doesn't _really_ have a value for A.  I do need to have both
  35. >indexes for performance reasons.  I don't think that setting optimization
  36. >to low is an option in this case since it effects the whole database
  37. >back end and not just the single query.  We are running Online V 4.10.UF2, 
  38. >SQL V 4.00.UG2 on a Pyramid MI Server.
  39. >
  40. If uou split your query unto two statements:
  41. where c=value and d=value and b=value into temp Q;
  42. select * from Q
  43. where a>value...
  44.  
  45. It'll work fine, but take a little longer than you anticipate.
  46.  
  47. PAX
  48. Steve Glines 
  49.  
  50.