Home » RDBMS Server » Performance Tuning » Need help on Query Tuning
Need help on Query Tuning [message #405485] Thu, 28 May 2009 00:54 Go to next message
sivakumar.rj
Messages: 17
Registered: November 2008
Location: Chennai
Junior Member
I have a query which is having a case statement. The query is taking long time to executed. Is it possible to replace the case statement.

SELECT CASE
WHEN COUNT(DECODE(<fn1>,'A',1))>0 THEN 1
WHEN COUNT(DECODE(<FN2>,'A',1))>0 THEN 2
WHEN COUNT(DECODE(<FN2>,'B',1))>0 THEN 3
ELSE 4
END
FROM TBL 1,TBL2, TBL3
WHERE <EQUI JOIN CONDITIONS>

pls let me know..whether this case statement can be replaced or not....??
Re: Need help on Query Tuning [message #405489 is a reply to message #405485] Thu, 28 May 2009 01:05 Go to previous message
Michel Cadot
Messages: 64119
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
From your previous topic named "Tuning the query":
BlackSwan wrote on Tue, 24 March 2009 06:27
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
...

Michel Cadot wrote on Tue, 24 March 2009 06:38
You can first read:
- OraFAQ Forum Guide, Performance Tuning section
- Performances Tuning sticky
- OraFAQ Performance Tuning
- Rosco's SQL Tuning Guide

Then provide the requested and usual information.

You can also have a look at Database Performance Tuning Guide.
...

This is NOT the case part that costs this is the rest (and most likely what you didn't post like custom function calls).

Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel


[Updated on: Thu, 28 May 2009 01:06]

Report message to a moderator

Previous Topic: Delete statement taking long time in Test database
Next Topic: Very slow commit
Goto Forum:
  


Current Time: Tue Dec 06 10:01:34 CST 2016

Total time taken to generate the page: 0.18722 seconds