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 |
Send this thread to your friend |
|
|
|
|
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 Khokhar | 857 |
| Mohammed Taj | 746 |
| positive fanatic | 483 |
| Jayanta Sur | 479 |
| Vigyan Kaushik | 386 |
| Vinoth Kumar | 357 |
| Gopu Gopi | 340 |
| Gitesh Trivedi | 322 |
| neeraj sharma | 258 |
| Ramesh Jois | 246 |
|
|