for $pers in (input()/Person[@Name='Benoit' and @Valid=1 and @Vorname='Albert' and Address[Street and not(PNumber) and not(City)]])[position() > 0 and position() <= 10] return $pers
When I execture this Xquery I wait a few minutes before to receive an answer!!!
However, I have a Text index on City et PNumber!
Has anyone an idea, how can I improve the performance of my xquery?
Yes of course @Naame and @Vorname et @Valid has an indexe. But when I execute this xquery without the negative function not(…), the responses of the query is fast. But when I execute the query with the negative function not(…), it’s take a long time:
Do you know anything else to improve the performance?
without details about number and size of documents I cannot test, but you might try the following modified query to see whether separating the conditions helps:
for $pers in (input()/Person[@Name='Benoit' and @Valid=1 and @Vorname='Albert'])
let $address:=$pers/Address
where $address/Street and not($address/PNumber) and not($address/City)
return $pers
I left out position by purpose, to make the query simpler, this can be re-added later
But the result for the performance is the same! The database contains 150’000 records of person and this structure Person XML contains others lements than theses I show you.
I have another idea! Now, I have a text index on PNumber et City element. I will apply a standard-text on these two elements and the conidtion in the query will be
insead of
I see that the condition not(…) in xquery takes a lot of Tamino ressources.
Your posting says that you have defined a text index. Unfortunately the text index can not be use for comparison predicates. Please define a standard index on the elements / attributes you are considering.