In my application there is an OQL execution for data retrieval. In where clause firstname comparison is done with equal operator. Example: WHERE firstName = ‘YYY’ Now I have to replace equal operator with like operation and sorting should be introduced. Example: WHERE firstName like ‘YYY%’ order by firstName The new OQL is consuming more time than previous OQL during concurrency testing. I have added Indexes as well but no improvements. Is there any other way to optimize?
A ‘like’ operator is always more costly than ‘=’.
Like ‘%YYY%’ is slower than Like ‘YYY%’
The reason for that is the = can use trees and hashes very efficient and the ‘like’ needs more comparisons.