Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Reports

This is a discussion on Reports within the Oracle forums, part of the Databases category; While preparing reports I am creating a temporary table and then taking data from that temporary table. Does it have any effect on performance if we take data directly from ...

Go Back   Geeks Talk > Databases > Oracle
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

Oracle Oracle 9i & Oracle 10g Knowledge Base Learn and Share Oracle Technology related articles, white papers, tutorials / study materials, example codes, FAQ's, Tips and Tricks.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-26-2007
Expert Member
 
Join Date: Sep 2007
Posts: 738
Thanks: 22
Thanked 67 Times in 65 Posts
krishnaindia2007 is on a distinguished road
Reports

While preparing reports I am creating a temporary table and then taking data from that temporary table. Does it have any effect on performance if we take data directly from the base table for generating reports?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-27-2007
Expert Member
 
Join Date: Apr 2007
Location: Bangalore
Posts: 497
Thanks: 29
Thanked 61 Times in 59 Posts
susarlasireesha is on a distinguished road
Re: Reports

One of the shortcomings of relational databases is their inability to create intermediate result sets. One technique that is used within all relational databases is the creation of interim (temporary) tables to improve the speed of their SQL queries.

Temporary tables are generally used as a mechanism to pre-join tables, or pre-aggregate intermediate data. As such, the use of temporary tables is more effective in highly normalized databases. A data warehouse with lot’s of denormalization may not benefit from queries that use temporary tables.

The prudent use of temporary tables can dramatically improve Oracle SQL performance. To illustrate the concept, consider the following example from the DBA world. In the query that follows, we want to identify all users who exist within Oracle who have not been granted a role. We could formulate the query as an anti-join with a noncorrelated subquery as shown here:

select
username
from
dba_users
where
username NOT IN
(select grantee from dba_role_privs);

On a large database, this query runs in about 18 seconds. Now, we rewrite the same query to utilize temporary tables by selecting the distinct values from each table.

drop table temp1;
drop table temp2;

create table
temp1
as
select
username
from
dba_users;

create table
temp2
as
select distinct
grantee
from
dba_role_privs;

select
username
from
temp1
where
username not in
(select grantee from temp2);

With the addition of temporary tables to hold the intermediate results, this query runs in less than three seconds, a 6-fold performance increase. Again, it is not easy to quantify the reason for this speed increase, since the DBA views do not map directly to Oracle tables, but it is clear that temporary table show promise for improving the execution speed of certain types of Oracle SQL queries.

Temporary tables are also useful in cases where we need to compare two ranges of dates in a single table.
Reply With Quote
The Following User Says Thank You to susarlasireesha For This Useful Post:
Reply

  Geeks Talk > Databases > Oracle

Thread Tools
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 On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
reports sweetychinnu C# 2 11-16-2008 04:38 AM
When to make reports on WEB I Raanu Data Warehousing 1 08-02-2008 07:17 PM
Drill down reports vs interactive reports Geek_Guest SAP R/3 0 09-16-2007 07:11 AM
Can we creates reports (metadata reports) in informatica satyaramesh Data Warehousing 1 07-23-2007 11:02 AM
I need to test reports puja123 Test Cases 4 04-25-2007 03:53 AM


All times are GMT -4. The time now is 05:50 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved