Home » RDBMS Server » Performance Tuning » Can we improve this qry.
Can we improve this qry. [message #165914] Mon, 03 April 2006 05:25 Go to next message
frank.svs
Messages: 162
Registered: February 2006
Senior Member

I've 3 tables and i am joining the 3 tables. Now can i improve the performance of the query-4

The following are 3 tables

query-1
-------
select * from grades
grade_id,grade
g1 A
g2 B

query-2
-------
select * from races
raceid race
r1 white
r2 black

query-3
-------

select * from student
sid,sname,race_id,grade_id
101 mmm r1 g1
102 kkk r2 g2


query-4
-------
//to get the detailed info i've joined the 3 tables
SELECT SID,SNAME,race,grade
from student s,races r,grades g where s.race_id=r.raceid
and s.grade_id=g.grade_id

can the above qry can be rewritten using any sub-quieries to improve performance.If so
i want some suggestions.

Thanks and Regards.
frank
Re: Can we improve this qry. [message #165916 is a reply to message #165914] Mon, 03 April 2006 05:34 Go to previous messageGo to next message
madhusunkara
Messages: 59
Registered: March 2006
Location: hyderabad,india
Member
how many rows does each table have , do you have indexes already on the fields (writing subquery may not be good choice here)

Regards
Madhu
Re: Can we improve this qry. [message #182242 is a reply to message #165914] Thu, 13 July 2006 22:21 Go to previous message
nmacdannald
Messages: 460
Registered: July 2005
Location: Stockton, California - US...
Senior Member
I havd extensive experience trying to improve queries. I have fould the best way is to update the optimizer statistics and look at the cost to see if an index would help. Or that you are using the correct index and providing the keys(segemnts of a multi-segment key) for that index. Given the proper opportunity, Oracle does a great job of optimizing.

check the init.ora file to see how the first_rows is set?
Neil.
Previous Topic: Compressing indexes that have a timestamp in first column.
Next Topic: "Advice" on shared_pool and buffer cache size
Goto Forum:
  


Current Time: Sat Nov 23 12:58:14 CST 2024