SSISO Community

시소당

인덱스 컬럼의 가공시는 주의한다.

인덱스  컬럼을  가공하게  되면  인덱스를  사용하지  못한다.  그러므로  인덱스  컬럼을  가공할  때는  각별히  주의한다.

Select  account_name,  trans_date,  amount
From  Transaction
Where  Substr(account_name,1,7)  =  ‘CAPITAL’;

<개선안>
Select  account_name,  trans_date,  amount
From  Transaction
Where  account_name  like  ‘CAPITAL%’;

Select  account_name,  trans_date,  amount
From  Transaction
Where  amount  !=  0;
<개선안>
Select  account_name,  trans_date,  amount
From  Transaction
Where  amount  >  0;

Select  account_name,  trans_date,  amount
From  Transaction
Where  account_name  ||  account_type  =  ‘MAXA’

<개선안>
Select  account_name,  trans_date,  amount
From  Transaction
Where  account_name  =  ‘MAX’
And  account_type  =  ‘A’;

Select  account_name,  trans_date,  amount
From  Transaction
Where  Trunc(trans_date)  =  Trunc(sysdate)

<개선안>
Select  account_name,  trans_date,  amount
From  Transaction
Where  trans_date  Between  Trunc(sysdate)  and  Trunc(sysdate)  +  .99999;

604 view

4.0 stars