Feb 7, 2008

Oracle LIKE vs. SUBSTR evaluation

You learn something new every day. Today after a fair amount of testing, I discovered that...


SELECT
*
FROM
MYTABLE
WHERE
ID LIKE 'STRING%'

...is about about twice as fast as

SELECT
*
FROM
MYTABLE
WHERE
SUBSTR(ID,1,STRINGLENTH) = 'STRING'


YMMV.

0 comments: