[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.2

Performance Problems with Oracle Table Functions

Asked by finaris in Oracle Database, PL / SQL, Oracle 9.x

Tags: Oracle PL SQL

Good afternoon,

I have got two functions returning the results of an SQL execution:
 - a pipelined function returning a table of records.
 - a non-pipelined function returning a table of objects.
I call those two functions using an Oracle Table function. (s. Code Snippet)

As an alternative I have got the same SQL, hard coded in an Oracle View.

If I compare these alternatives, the execution of the View takes much less time than the other two alternatives. In detail, all operations need more or less the same time except that the table fucntion version appends another sort output operation. Here are some long-op stats taken from Toad:
 - for the View:
     Table scan (114389 Blocks):         21s
     Hash Join (56854 Blocks):             45s
     Sort Output I (48867 Blocks):       71s

 - for the function returning the table of records:
     Table scan (114389 Blocks):         21s
     Hash Join (56854 Blocks):             43s
     Sort Output I (48867 Blocks):       69s
     Sort Output II (117763 Blocks):  132s

I noticed, that this effect does not depend on the overall execution time of the SQL code, but on the overall volume of returned datasets. For example, the above stats result in 4m datasets. The overall execution time is round about 150secs (and 350 secs for version with the table functions). The problem does not occur for an SQL running 400secs but only returning 1k datasets. So I am pretty sure, that the "waste of time" happens due to the outside table-function. Nevertheless I have got no clue, how to handle this problem.

Any ideas around? Is there any kind of way to get around the second sort output?

Best regards and thanks in advance
FINARIS
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
function get_my_table return my_types.my_table_type PIPELINED is
 
	stmt long := null;
 
	v_rec	my_types.my_record_type;
 
	TYPE t_cur IS REF CURSOR;
	cur t_cur;
 
begin
	stmt := get_my_sql_statement;
	open cur for stmt;
	loop
		fetch cur into v_rec;
		exit when cur%notfound;
		PIPE ROW(v_rec);
	end loop;
	close cur;
	return;
end get_my_table;
 
 
select * from table(my_pack.get_my_table())
[+][-]05/27/08 05:28 AM, ID: 21651218Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Oracle Database, PL / SQL, Oracle 9.x
Tags: Oracle PL SQL
Sign Up Now!
Solution Provided By: schwertner
Participating Experts: 1
Solution Grade: A
 
[+][-]05/26/08 07:57 AM, ID: 21646704Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/26/08 08:46 AM, ID: 21646919Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/26/08 12:04 PM, ID: 21647644Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/27/08 05:12 AM, ID: 21651124Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/20/08 02:16 PM, ID: 22531654Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]09/26/08 04:30 PM, ID: 22584749Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 / EE_QW_2_20070628