Would
WHERE substr(my_field,1,6) = \'search\'
or
WHERE my_field LIKE \'search%\'
be faster in Oracle, o
If you have no index than there is no difference. Because oracle is doing a full table scan and evaluates the expression for each row. You can put an index on the column to speed up both queries.
CREATE INDEX my_like_idx
ON my_table( my_field );
This index is more flexible and speeds up the query using like. It will work for any compare starting with characters and having placeholder (%) at the end. Oracle is doing a index range scan to find all matching rows.
CREATE INDEX my_substr_idx
ON my_table( substr( my_field,1,6 ) );
This index speeds up the query with substr. But the index is very special to compare only the first 6 characters.
If you query for a piece of starting in the middle. Creating a function based index will help.
WHERE substr(my_field,2,5) = 'earch'
WHERE my_field like '%earch%'