If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > cursor performance advantage

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-17-09, 07:14
sunsail sunsail is offline
Registered User
 
Join Date: Dec 2008
Posts: 99
cursor performance advantage

Hello,

I have a very long sql query,and it contains 'like name '%aaa%' kind of filters.
I m wondering if I put this sql into plsql cursor and get it output from procedure,would it be faster? if so how can I measure it
I like to compare this sql runtime with plsql runtime.
I have toad and oracle sql developer tools

Best Regards
Reply With Quote
  #2 (permalink)  
Old 07-17-09, 07:54
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool No improvement

Changing SQL statement to execute in PL/SQL cursor would not improve the response time.

For queries that contain 'like name '%aaa%' kind of filters, perhaps using Oracle text indexes would help.
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
  #3 (permalink)  
Old 07-17-09, 08:02
sunsail sunsail is offline
Registered User
 
Join Date: Dec 2008
Posts: 99
Hello,
I found this and I m using in my situation
Implicit vs. Explicit Cursors which is faster - cursor_comparison.sql script

first I put filter in cursor definition
cursor c_1 is
select ...where like...;

secondly I put in the code
begin...

open c_1
fetch ...into...;
if ..like then
end if
close c_1

does this work in this case? for the same test time comsumption changes :/

Best Regards
Reply With Quote
  #4 (permalink)  
Old 07-17-09, 09:02
JRowbottom JRowbottom is offline
Registered User
 
Join Date: Feb 2009
Posts: 62
No - Fetching every row from the table and manually filtering them to see which ones match the condition will be slower than using a query that only fetches the rows that match the condition in the first place.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On