I don't know if someone can kindly elaborate the reason beneath it. For example, why operator "starts with" is not optimized. Thank you so much.
Hi,
I think some information around this can be found in the documentation, specifically at text indexes and query performance, but I'll try to do some shorter summery from my understanding of it.
StartsWith (and equality) predicates are very efficient if the indexed values are stored alphabetically, once you find a value that is 'larger' alphabetically you know that you no longer start with the correct string and can stop the search.
However, having the values stored alphabetically is not efficient for endsWith and containts, as they would need to look at all values to check if they matches.
Due to this, the text indexes are not storing their values alphabetically but instead in a way that are more efficient for the endsWith and contains predicates.
This means that while the text index can satisfy a startsWith predicate it is less efficient at doing so than a regular range index, which stores their string values alphabetically.
I hope that helped,
Therese
Thank you Therese.