Details
Description
If there is a query of this form with an index that supports path restrictions (evaluatePathRestrictions = true):
select * from [nt:base] where [indexedProperty] = x and (issamenode('/content') or isdescendantnode('/content'))
then the path restriction isn't used in the index.
This is unfortunate, because the index returns a lot more results, and the query engine will have to check if the path matches the condition.
How this works: the query engine creates two possible queries:
- plan a: one with just the [indexedProperty] = x condition, and no path restriction
- plan b: a union query, where one side uses issamenode and the other side uses isdescendantnode.
The index will return the same cost no matter if a path condition is there or not. And that's why the query engine will pick plan a: because the cost of the union query is higher.
The index should return a lower cost if there is a path restriction. (Right now the query engine will reduce the cost if there is a path restriction, but that's not sufficient for this case).
Attachments
Issue Links
- links to