[Oracle] 집계함수를 분석함수로 변경 튜닝
2024. 2. 21.
SELECT * FROM (SELECT /*+ LEADING(D) USE_NL(D EMP_V) PUSH_PRED(EMP_V) INDEX(EMP_V.E EMP_N1) */ D.DNAME, EMP_V.DEPTNO, EMP_V.HIREDATE, EMP_V.MIN_JOB, ROWNUM CNT FROM (SELECT E.DEPTNO, TO_CHAR(E.HIREDATE, 'YYYYMMDD') HIREDATE, MIN(E.JOB) MIN_JOB FROM EMP E GROUP BY E.DEPTNO, TO_CHAR(E.HIREDATE, 'YYYYMMDD')) EMP_V, DEPT D WHERE EMP_V.DEPTNO = D.DEPTNO AND D.DNAME = :B1 ) WHERE CNT