• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Optimizing queries

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a query tool which gets results based on inputs provided by users. I have several different SQL JOIN statements involving 6-8 tables in each query. Some involve outer joins too. I would like to know what steps should be taken to make these queries efficient and quick.
I have been using the concept of having the smallest table first in the FROM clause, and the largest(in terms of rows) at the end of FROM clause. Alongwith this, I'm trying to put the most important JOIN CONDITION first in the WHERE clause. I'm using Oracle 8i, and PreparedStatements to execute these queries.
Any suggestions would be helpful.
Thanks.
 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the most important thing to look at is your indexes. Which indexes to create, and to make sure they are used when the sql executes. Perhaps using HINTS in the SQL if you think Oracle will not choose the quickest path. If you have very small tables, you don't need indexes because the entire table will be pulled in.
Dan
[This message has been edited by Daniel Dunleavy (edited May 21, 2001).]
reply
    Bookmark Topic Watch Topic
  • New Topic