for the following code I am getting expanded tree cache full:
xquery version "1.0-ml";
let $result :=
<root>{
cts:search(
fn:collection("metadata-search")/metadata,
cts:and-query((
cts:element-value-query(xs:QName('AssetID'), "*")
))
)/assetIdentifiers/assetIdentifier/AssetID
}</root>
let $path := "D:\Output\input.xml"
return
xdmp:save($path, $result,
<options xmlns="xdmp:save">
<method>xml</method>
</options>
)
but if same code I ran in iteration mode it was working fine:
xquery version "1.0-ml";
let $result :=
<root>{
for $data in cts:search(
fn:collection("metadata-search")/metadata,
cts:and-query((
cts:element-value-query(xs:QName('AssetID'), "*")
))
)
return $data/assetIdentifiers/assetIdentifier/AssetID
}</root>
let $path := "D:\Output\input.xml"
return
xdmp:save($path, $result,
<options xmlns="xdmp:save">
<method>xml</method>
</options>
)
there are 450000 assets in database and it took 10 min to run, I was wondering why other code construct works fine and not first one? Any Idea, please let me know in detail with the context of this code ?