jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Stocker <christian.stoc...@liip.ch>
Subject Strange Search Performance problem with OR
Date Mon, 26 Mar 2012 20:28:30 GMT
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

Mime
View raw message