Ideally I think you'd want both to be optimized. (Otherwise you'll
materialize a potentially huge intermediate result for the unoptimized
one.) Easy for me to say, of course.... :)
On 3/6/17 6:59 PM, christina pavlopoulou wrote:
Hello everyone,
I try to run the following query:
for $i in collection($sensors)/dataCollection/data
group by $date:=$i/date
return count($i)
This query runs correctly but the optimized plan that is returned is
not fully optimized because the count function is calculated after the
group by operator and not inside it. However, if I change the return
expression to the following: return count(for $j in $i return $j) the
query plan is fully optimized. Should I leave the first query as it is
or should I try to optimize this version too?
Thanks,
Christina
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus