apex – SOQL with ‘LIKE’ and wildcards ‘%’ in between words
I’m aware that
Using a wildcard such as LIKE ‘%term in SOQL queries prevents the use of indexes and causes full-table scans. Full-table scans increase query execution time and CPU usage. Use indexed fields for filtering and optimized search strategies.
But my question is, is it also the case when wildcard is not at the start of the term but in between words, for example:
‘term%to%search%’
Will it also cause full-table scans? I want to use this kind of filtering on a custom text field and also in different query on Account Name. Should I worry about performance, or if the query will return all relevant results?
I also thought about using SOSL for this case, but from what I’ve read, it is even worse when it comes to searches through larger datasets, especially when there is a WHERE clause with additional conditions.
Read more here: Source link
