Good morning,
I wondered if there is room for optimization during the compilation of the following query:
let $oneBillion := 1000000000 for $x at $p in (1 to $oneBillion ) where $p = 1 return $x
I would have expected this to be compiled into something like
for $x in (1 to $oneBillion)[1] return $x
Or simply
(1 to $oneBillion)[1]
Judging only from the execution times of the original query versus the optimized ones, it seems the sequence of 1 to one billion is entirely generated, which seems suboptimal in this case.
Kind regards, Daniël Knippers