tuning against count with group by clause [message #549497] |
Sat, 31 March 2012 04:29 |
manoj12
Messages: 210 Registered: March 2008 Location: India
|
Senior Member |
|
|
Hi Sir
This query is taking 7 hours to execute as I am retrieving data from history table dept_hist.
This query is taking 7 hours to execute
select count(distinct empid), e.group_nm, d.date,
from emp e, dept_hist d
where e.deptno = d.deptno
and e.up_ts > sysdate -30
and e.stat_cd between 100 and 200
and e.group_nm like '%EMPNO%'
and employee_id =1
and e.employee_id = d.employee_id
group by group_nm,d.date;
Its taking 7 hours to execute.can u help me in restructing this query.Any methods to tune this query will be helpful?
Thanks & Regards
[EDITED by LF: after topics have being merged, I reformatted the code and applied [code] tags. Manoj did that himself in a duplicate message which has lost after merging]
[Updated on: Sat, 31 March 2012 08:35] by Moderator Report message to a moderator
|
|
|
|
|
|
|