Table alias has an effect with execution time?
- by RedFux227
So I have this query :
SELECT A.e_cd "INFLATE" , A.ccgpt "1" , ( SELECT J.comp
FROM JBB J
WHERE J.e_cd=A.e_cd
AND emplo_RCD=:1
AND J.Dte = ( SELECT MAX(J1.Dte)
FROM JBB J1
WHERE J.e_cd=J1.e_cd
AND TO_CHAR(J1.Dte,'MM') <=A.mth_to
AND TO_CHAR(J1.Dte,'YYYY') <=A.year )
AND J.seq = ( SELECT MAX(J2.seq)
FROM PS_JOB J2
WHERE J2.e_cd=J.e_cd
AND J2.Dte=J.Dte)) "Company"
FROM PPS A
WHERE orcd=:2
AND rcd=:3
AND tx_cd=:4
AND year=:5
With this one :
SELECT A.e_cd "INFLATE" , A.ccgpt "1" , ( SELECT J.comp
FROM JBB J
WHERE J.e_cd=A.e_cd
AND emplo_RCD=:1
AND J.Dte = ( SELECT MAX(J1.Dte)
FROM JBB J1
WHERE J.e_cd=J1.e_cd
AND TO_CHAR(J1.Dte,'MM') <=A.mth_to
AND TO_CHAR(J1.Dte,'YYYY') <=A.year )
AND J.seq = ( SELECT MAX(J1.seq)
**FROM PS_JOB J1
WHERE J1.e_cd=J.e_cd
AND J1.Dte=J.Dte**)) "Company"
FROM PPS A
WHERE orcd=:2
AND rcd=:3
AND tx_cd=:4
AND year=:5
The 1st query run for about 3.20 sec with buffer gets 8,134 and for the 2nd query it run for about 1.73 sec with buffer gets 7,006.
So, is the table alias somehow has an impact on the execution time / buffer gets?
Thanks in advance!