I have the following query using ISDESCENDANTNODE.

SELECT * FROM [nt:customNode] AS document

WHERE (

     ISDESCENDANTNODE(document, '/ourRoot/4709617c-2b4a-4dbd-ab63-4a97ca66c5c2/2917bd05-74f7-43da-9506-30dd7631cafc')

     OR ISDESCENDANTNODE(document, '/ourRoot/4709617c-2b4a-4dbd-ab63-4a97ca66c5c2/libraries/378d57e4-0036-4537-bdd4-305e62aa9a67/1')

)

AND (

    CONTAINS (document.name, 'bye')

    OR CONTAINS (document.alias, 'Greeting')

)

AND (

    documentType='FLOW'

    OR documentType='LANGUAGE_OBJECT'

)

 

This takes 1394ms. When I comment out the first ISDESCENDANTNODE the query takes 149ms. When I comment out the other, instead, the query takes 172ms.

 

It seems to me that the original query shouldn’t take almost 10 times as long with both ISDESCENDANTNODE in.