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

Reply via email to