home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / database / oracle / 2238 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  1.5 KB

  1. Path: sparky!uunet!sun-barr!cs.utexas.edu!qt.cs.utexas.edu!news.Brown.EDU!noc.near.net!news.centerline.com!sebastian.centerline.com!user
  2. From: dewey@centerline.com (Devan F. dewey)
  3. Newsgroups: comp.databases.oracle
  4. Subject: index column order perfomance effects
  5. Followup-To: comp.databases.oracle
  6. Date: 18 Nov 1992 19:57:19 GMT
  7. Organization: CenterLine Software, Inc.
  8. Lines: 34
  9. Distribution: world
  10. Message-ID: <dewey-181192145202@sebastian.centerline.com>
  11. NNTP-Posting-Host: 140.239.3.212
  12.  
  13. I have a view of my database which links three tables
  14. by COMPANY#. One of these tables contains a rep_code and another
  15. contains a followup_date.
  16.  
  17. There is an index on table1(rep_code).
  18.  
  19. When I create an index on table2(followup_date, company#)
  20. and did:
  21.  
  22. select count(*) from view
  23.     where rep_code = 'AA'
  24.     and followup_date = TODAY;
  25.  
  26. the query took over an hour.
  27.  
  28. So I drops the index on table2 and created and index on the same
  29. columns in a different order: table2(company#, followup_date).
  30.  
  31. Now the same query executed in 8 seconds.
  32.  
  33. I'm happy I got it working, but can anyone explain the dynamics of
  34. why it works this way. I think I should know this before I
  35. create too many more indexes.
  36.  
  37. Thanks for any info.
  38.  
  39. -Devan
  40.  
  41.                              
  42.                Devan F. Dewey | Senior Systems Analyst
  43.           CenterLine Software | dewey@centerline.com
  44.             10 Fawcett Street | "Leme esplain - no dere is
  45.           Cambridge, MA 02138 | too much. Leme sum up."
  46.                                        -Inigo Montoya
  47.