Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Tuning the sql query

girish1982Jul 14 2008 — edited Oct 14 2008

Hi All,
I have query in using oracle report , its taking long time to run the report when we run for 1 month period , even its taking time trying with 1 or 2 days also .
below is the query , here we are using most of the VIew also , please help me how to improve the perfomance of this.what needs to concentrate mainly here . please help me out. Thanks in advance.

SELECT                                                                   
         pd.segment20 discipline, 
		 ppx.employee_number,
         SUBSTR (ppx.full_name, 1, 50) fullname,
		 pj.NAME designation,
         horg.NAME department,
		 SUM (a.measure) hours,
         d.segment1 projectnumber, 
		 d.NAME projectname, 
		 pat.task_name     
FROM     per_analysis_criteria pd,
         per_people_x ppx,
         per_jobs_v pj,
         hr_all_organization_units horg,
         hxc_time_building_blocks a,
		 pa_projects_all d,
		 pa_tasks pat, 
         hxc_time_attribute_usages b,
         hxc_time_attributes c,
         hxc_time_building_blocks DAY,
         hxc_time_building_blocks TIME,
         per_assignments_x pax,
         hxc_timecard_summary summary,
         per_person_analyses pe,
         per_special_info_types_v pf
   WHERE pax.organization_id  = horg.organization_id
     AND pd.id_flex_num 			  = pf.id_flex_num
     AND pd.analysis_criteria_id 	  = pe.analysis_criteria_id
     AND pax.job_id          = pj.job_id
     AND c.attribute1        = pat.project_id
     AND c.attribute2        = pat.task_id
     AND a.time_building_block_id = b.time_building_block_id
     AND d.project_id        = c.attribute1
     AND pat.task_id         = c.attribute2
     AND b.time_attribute_id = c.time_attribute_id
     AND a.parent_building_block_id   = DAY.time_building_block_id
     AND a.parent_building_block_ovn  = DAY.object_version_number
     AND DAY.parent_building_block_id = TIME.time_building_block_id
     AND DAY.parent_building_block_ovn= TIME.object_version_number
     AND TIME.time_building_block_id  = summary.timecard_id
     AND TIME.object_version_number   = summary.timecard_ovn
     AND a.resource_id                = ppx.person_id
     AND ppx.person_id 				  = pax.person_id
     AND pf.id_flex_num 			  = pe.id_flex_num
     AND pe.person_id 				  = ppx.person_id
     AND pf.business_group_id 		  = pe.business_group_id
     AND a.object_version_number 	  = b.time_building_block_ovn
     AND pax.primary_flag 			  = 'Y'
     AND summary.approval_status 	  = 'APPROVED'
     AND a.SCOPE 					  = 'DETAIL'
     AND pf.NAME 					  = 'SEC Staff Movement'
     AND c.attribute_category 		  = 'PROJECTS'
     AND d.segment1 LIKE '905%'
     AND DAY.start_time  	   		  >= :p_start_date
     AND TRUNC (DAY.stop_time, 'DD')  <= :p_end_date
     AND SYSDATE BETWEEN a.date_from    AND a.date_to
     AND SYSDATE BETWEEN DAY.date_from  AND DAY.date_to
     AND SYSDATE BETWEEN TIME.date_from AND TIME.date_to
     AND a.object_version_number =
                  (SELECT MAX (b.object_version_number)
                     FROM hxc_time_building_blocks b
                    WHERE b.time_building_block_id = a.time_building_block_id)
     AND pe.date_from = (SELECT MAX (xsm.date_from)
                           FROM xsec_staff_movement xsm
                          WHERE xsm.emp_person_id = ppx.person_id)
GROUP BY pd.segment20,
         ppx.employee_number,
         SUBSTR (ppx.full_name, 1, 50),
         pj.NAME,
         horg.NAME,
         d.segment1,
         d.NAME,
         pat.task_name


[\pre]

Thanks 
RG

Message was edited by: 
        user549459                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 11 2008
Added on Jul 14 2008
98 comments
4,954 views