Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: SQL*Plus and PL/SQL >> Cursor optimization

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: Cursor optimization
 leomar  Posted: Sep 28, 2006 06:07:12 AM

 Total Post: 2
 Joined: Sep, 2006






 Hi to all.
Pls, I need you.

I have a pl-sql procedure which take a long time to be executed. Due to an analisys make on this procedure, I saw there are two cursor that take too much time releted to the total time.
The query performed by these cursor are very complicated and involved more table that contains many data.
So, cause the cursor, for each row fetched, need to do other operations, the big amount of time is caused by the big amount of data.
Hence the question is: make sense to add index to the tables involved in the query used by the cursor, or use hints or use other similar solutions?

Thanks a lot to all.
Also the more simplex suggestion is appreciated.

 Vigyan
Posted: Sep 28, 2006 09:36:27 PM  

 Total Post: 386
 Joined: May, 2001






 
If you think, query is taking long time then take query from the program and see if you can tune it.

If you are in Oracle 10g, you can use SQL Advisor to tune it.

Hope it helps.

Vigyan


 Gai
Posted: Oct 02, 2006 03:37:33 PM  

 Total Post: 8
 Joined: Aug, 2006






 
I guess that these should help.

1. Get rid of any order by clause in the query of the cursor
2. place those where conditions fist which you know has a value. For example, Col_A IS NULL, COL_B >2 etc.
3. Place those where conditions next which you think are the primary keys.
4. Always tryto avoid using aggregate functions in the select clause as far as possible. This will make the index (on primary key or any index) non-functional.


 Time Zone: EDT

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Vinoth Kumar357
  Gopu Gopi340
  Gitesh Trivedi322
  neeraj sharma258
  Ramesh Jois246






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software