Selva
Selva

Reputation: 237

performance of element-value-query vs element-range-query

I have an element range index configured for an element in my database. I am trying to run a search query on that element. The element contains string values and i need to search for one particular string value (not a range of values or date). Though both element-value and element-range queries can be used, and index is already present, Will both these queries perform in same way? or element-range performs better in this scenario?

Upvotes: 3

Views: 636

Answers (2)

mholstege
mholstege

Reputation: 4912

The range-query is also answering a different question from the value-query.

Value queries query for matching word sequences, not matching strings. By default they are stemmed too, so cts:element-value-query(xs:QName("x"),"be fine") will match <x>Is finer</x>. Unless you do an exact unstemmed unwildcarded value query, an unfiltered search will not be able to resolve space and punctuation differences, either.

Range queries (on strings) are matching strings under the rules of a particular collation.

Upvotes: 3

Tyler Replogle
Tyler Replogle

Reputation: 1339

The range query will be faster.

The element value query uses the universal index and that isn't full in memory

The range query users a ranged index and that's an in memory index.

The range query will be much faster as your data grows. It will also be faster if you have a lot of unique terms in that element.

Upvotes: 5

Related Questions