Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

substr Question

Status
Not open for further replies.

frangac

Technical User
Feb 8, 2004
163
0
0
ZA
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
 
SQL1
If there is an index on FE_F it will never be used (function on a column).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top