==Loop Unrolling==
{{Mark|Introduced with Version 9.6:}}
Loops with few iterations are ''unrolled'' by the XQuery compiler to enable further optimizations:
where $t/buyer/@person = $p/@id
return $t
return <item person='"{ $p/name/text() }'">{ count($a) }</item>,
(: rewritten to :)