Problem performance xquery with not(...)

Hello,

I have a Person structure XML like this exemple:

I write this Xquery:


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?

Thank you for your help!

Cedric

Do you have indexes on @Name and @Vorname? I would think that would be important too.

Hi Curtis,

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?

Thank you for your help!

Cedirc

Hi,

Does anyone know if I can change the xquery to have the same result without the function negative not(…).

Thank you for your help!

Cedric

Hi,

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

Best regards

Harald

I try your idea,

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.

If you have another idea, tell me!

Thank you for your help!

C

Hi,

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.

Best Regards,

Thorsten

Hi Thorsten,

I applied a standard on element PNumber and City. The performance of the xquery below is fast now:

Now the answer is very good!

Thank you everyone for your help and see you soon!

Cedric :wink: