home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / database / informix / 2743 < prev    next >
Encoding:
Internet Message Format  |  1992-12-20  |  2.3 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!swrinde!emory!emory!not-for-mail
  2. From: jparker@hpbs2776.boi.hp.com (Jack Parker)
  3. Newsgroups: comp.databases.informix
  4. Subject: Two index query optimization problem (fwd)
  5. Date: 17 Dec 1992 23:03:16 -0500
  6. Organization: Mailing List Gateway
  7. Lines: 44
  8. Sender: walt@mathcs.emory.edu
  9. Distribution: world
  10. Message-ID: <1grii4INN6tk@emory.mathcs.emory.edu>
  11. Reply-To: jparker@hpbs2776.boi.hp.com (Jack Parker)
  12. NNTP-Posting-Host: emory.mathcs.emory.edu
  13. X-Informix-List-ID: <list.1716>
  14.  
  15. } I'm having some problems with Informix over optimizing my query. 
  16. } I have a table with > 500000 rows and I can't get Informix to
  17. } use what I deem to be the "correct" index.
  18. } There are two indexes on the table:
  19. }    index1: unique index on A, B;
  20. }    index2: unique index on C, D, A, B;
  21. } The problem I'm having is that I can't run a query with A and B mentioned
  22. } in the WHERE clause that will use index2.  I suspect that the optimizer
  23. } is looking at the query and saying; hey, I got A, I got B, I've got a unique
  24. } index1 on both A and B.  Look no further, I am set dudes and dudettes, and 
  25. } I am outta here! (optimizers talk like that you know).
  26. } This would be fine if my queries were of the form:  
  27. }    WHERE C=value AND D=value A=value AND B=value; 
  28. }    
  29. } However, one of my queries is of the form:
  30. }    WHERE C=value AND D=value A>value AND B=value; 
  31. } so it doesn't _really_ have a value for A.  I do need to have both
  32. } indexes for performance reasons.  I don't think that setting optimization
  33. } to low is an option in this case since it effects the whole database
  34. } back end and not just the single query.  We are running Online V 4.10.UF2, 
  35. } SQL V 4.00.UG2 on a Pyramid MI Server.
  36.  
  37. Is c,d unique?  if so change index two to be just c,d.  If it isn't 
  38. try making c,d a dupe (and drop the a,b part).  
  39.  
  40. Maybe the optimizer isn't all that screwed up, try dropping index1 and 
  41. seeing how long the query takes versus how long it takes now.
  42.  
  43. j.
  44.  
  45. _____________________________________________________________________________
  46. Jack Parker - Contractor               | 
  47. Hewlett Packard, BSMC Boise, Idaho, USA|     Put it on the IN pile...
  48. jparker@hpbs2651.boi.hp.com            |      
  49. (208) 323-5388 (W)  (208) 384-1623 (H) |
  50. _____________________________________________________________________________
  51.