Hi Paul,

Optimizing XPath is always tricky. I think the optimizer didn’t recognize that 
`collection($mycollection)/myelem`  and ` collection($mycollection)[./myelem]` 
are (in terms of index resolution) effectively the same. And if the optimizer 
didn’t, it is likely that MarkLogic would have to filter out much more false 
positives in filtering stage.

Cheers,
Geert

From: <general-boun...@developer.marklogic.com> on behalf of Paul M 
<pjm...@yahoo.com>
Reply-To: MarkLogic Developer Discussion <general@developer.marklogic.com>
Date: Wednesday, May 23, 2018 at 6:06 PM
To: "general@developer.marklogic.com" <general@developer.marklogic.com>
Subject: [MarkLogic Dev General] fragments filter large difference

collection($mycollection)/myelem[.//myA[@myattr="myval"]//myB="val"]
vs
collection($mycollection)[./myelem//myA[@myattr="myval"]//myB="val"]

The first iteration performs markedly better than the second.
The second attempts to filter a million + fragments.

xdmp:query-trace shows only two constraints on the second iteration, namely 
fn:collection, when gathering constraints.

Any insight appreciated on why so different.


_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to