Home » RDBMS Server » Performance Tuning » How to improve performance (Oracle 9i)
How to improve performance [message #534511] Wed, 07 December 2011 00:25 Go to next message
ravi_n
Messages: 5
Registered: November 2011
Junior Member
Hi Experts,

SELECT emp_id,department.dept_code,dept_name,
FROM Employee,department
WHERE employee.dept_code=department.dept_code
AND salary>2000;

In employee table total 15000 records are there.
In department table total 500 records are there.

If I run this query it's taking 7 mins to execute.

Could you please help me to how to write
this join condition to improve performance.

Please provide the guidelines for how to write join conditions effectively.

Thanks in advance.
Re: How to improve performance [message #534524 is a reply to message #534511] Wed, 07 December 2011 01:19 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Try to add an index on dept_code and above all keep the statistics on the tables (and their indexes) up to date.

For any peformances question, please read http://www.orafaq.com/forum/mv/msg/84315/433888/102589/#msg_433888 and post the required information.

Regards
Michel
Re: How to improve performance [message #534587 is a reply to message #534524] Wed, 07 December 2011 09:51 Go to previous messageGo to next message
jrnayak
Messages: 35
Registered: November 2011
Location: London
Member
Create an index on salary column..The optimizer will do an index range scan to fetch the result set.
Re: How to improve performance [message #534591 is a reply to message #534587] Wed, 07 December 2011 10:41 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
It might, it might not, depends how many employees have a salary > 2000.
Re: How to improve performance [message #534602 is a reply to message #534591] Wed, 07 December 2011 12:34 Go to previous messageGo to next message
Roachcoach
Messages: 1576
Registered: May 2010
Location: UK
Senior Member
7 minutes for that sounds like poor stats>terrible plan, unless it's on on old P166 Wink
Re: How to improve performance [message #534619 is a reply to message #534602] Wed, 07 December 2011 17:36 Go to previous messageGo to next message
beetel
Messages: 96
Registered: April 2007
Member
Quote:
Please provide the guidelines for how to write join conditions effectively.


http://docs.oracle.com/html/A95912_01/wn32tune.htm#i631204
Re: How to improve performance [message #535412 is a reply to message #534619] Wed, 14 December 2011 01:28 Go to previous message
jameslongenecker
Messages: 1
Registered: November 2011
Junior Member
Thanks for the post.
Previous Topic: Can you please provide optimized query
Next Topic: simple select * from table is taking lot of time
Goto Forum:
  


Current Time: Wed Apr 24 21:03:26 CDT 2024