Hi All
Is there any explanation as to why the SQL1 statement (substr) takes longer than the SQL2 statement?
They are both index the same.
SQL1
select count(*) from CE.CDR_DRMS
where substr(FE_F,9,8) >= '20041001' and substr(FE_F,9,8) <= '20041001'
and STAT_CODE like 'r%';
SQL2
select count(*) from CE.CDR_DRMS
where R_DT >= '20041001 00:00:00' and R_DT <= '20041001 23:59:59'
and STAT_CODE like 'r%';
Many Thanks
Chris
Is there any explanation as to why the SQL1 statement (substr) takes longer than the SQL2 statement?
They are both index the same.
SQL1
select count(*) from CE.CDR_DRMS
where substr(FE_F,9,8) >= '20041001' and substr(FE_F,9,8) <= '20041001'
and STAT_CODE like 'r%';
SQL2
select count(*) from CE.CDR_DRMS
where R_DT >= '20041001 00:00:00' and R_DT <= '20041001 23:59:59'
and STAT_CODE like 'r%';
Many Thanks
Chris