cts:avg-aggregate( $range-index as cts:reference, [$options as xs:string*], [$query as cts:query?], [$forest-ids as xs:unsignedLong*] ) as xs:anyAtomicType?
Returns the average of the values given a value lexicon.
This function works like cts:avg
except it performs the
calculation in parallel in all data nodes then aggregates the values.
It generally performs better than cts:avg
, especially on
large clusters.
xquery version "1.0-ml"; (: This query assumes an element range index is configured in the database for the 'Amount' element. :) cts:avg-aggregate(cts:element-reference(xs:QName("Amount"))) => 122.2933333333333355
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.