Table alias has an effect with execution time?

Posted by RedFux227 on Stack Overflow See other posts from Stack Overflow or by RedFux227
Published on 2012-09-06T03:36:00Z Indexed on 2012/09/06 3:37 UTC
Read the original article Hit count: 379

Filed under:
|
|
|
|

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!

© Stack Overflow or respective owner

Related posts about table

Related posts about buffer