Query performance [message #361060] |
Mon, 24 November 2008 23:53 |
piscean_n
Messages: 36 Registered: December 2007
|
Member |
|
|
SELECT COUNT(*) FROM(SELECT distinct ra.emp_id FROM EMPLOYEE ra WHERE
ra.emp_id in
(
select rs.emp_id from employee_details rs WHERE rs.chg_date = '20080218' And
(rs.status in('ab','ac')
OR (ra.dept_id in ('S','L')and rs.status ='E')
)
)
OR ra.request_id IN
(
SELECT r.emp_id from employee r where TRUNC(r.CHG_DATE) = TO_DATE('18/02/2008','DD/MM/YYYY')
And (r.status in('ab','ac')
OR (ra.dept_id in ('S','L')and r.status ='E')
)
)
)
eXECUTION PLAN IS given below.
SELECT STATEMENT, GOAL = ALL_ROWS 6 1
SORT AGGREGATE 1
VIEW MNM 6 101
FILTER
PARTITION RANGE ALL 6 101 707
TABLE ACCESS FULL MNM EMPLOYEE 6 101 707
FILTER
PARTITION RANGE SINGLE 5 1 17
TABLE ACCESS BY LOCAL INDEX ROWID MNM EMPLOYEE_DETAILS 5 1 17
INDEX RANGE SCAN MNM IX_EMPLOYEE_DETAILS_1 2 12
FILTER
TABLE ACCESS BY GLOBAL INDEX ROWID MNM EMPLOYEE 2 1 15
INDEX UNIQUE SCAN MNM PK_EMPLOYEE 1 1
Can you please suggest to improve the query.
Thanks in advance
[Updated on: Mon, 24 November 2008 23:54] Report message to a moderator
|
|
|
|
|
|