Hi

We have the following search query


SELECT * FROM [own:unstructured] AS data WHERE data.guid = 'J7B1X'
                AND (ISDESCENDANTNODE(data, '/article')
                OR ISDESCENDANTNODE(data, '/import/article')
                )
                ORDER BY firstImportDate DESC


This query can take quite some time (up to 3 seconds, but it gets more
and more hte more data we have). In /article there's potentially a lot
of nodes, in /import/article usually almost nil.


If we now separate the query into 2:

SELECT * FROM [own:unstructured] AS data WHERE data.guid = 'J7B1X'
                AND ISDESCENDANTNODE(data, '/article')
                ORDER BY firstImportDate DESC

and

SELECT * FROM [own:unstructured] AS data WHERE data.guid = 'J7B1X'
                AND ISDESCENDANTNODE(data, '/import/article')
                ORDER BY firstImportDate DESC

Both queries take approx. 10ms (and return 0 or 1 resultset, more is not
possible). So quite fast.

Can anyone explain to me, why that is and how we could rewrite the query
to make it fast with a single one as well?

Thanks

chregu

Reply via email to