Yes, that was it. Thanks!
Best, Ron
On March 10, 2021 at 4:00:33 PM, Martin Honnen (martin.honnen@gmx.de) wrote:
On 10.03.2021 21:55, Ron Katriel wrote:
The queries you shared terminate quickly and don’t return anything. The one provided by Graydon does and completes significantly faster. I’m not sure what accounts for the difference.
I think I missed a step in the paths e.g.
On March 10, 2021 at 3:44:28 PM, Martin Honnen (martin.honnen@gmx.de mailto:martin.honnen@gmx.de) wrote:
(: 3 items - 52 sec :) let $safetyreport := db:open('FAERS')/ichicsr/safetyreport for $value in distinct-values($safetyreport/patient/patientsex) return concat($value, " ", count(index-of($safetyreport/patient/patientsex, $value)))
You could always try whether grouping performs better e.g.
for $ps in db:open('FAERS')/ichicsr/safetyreport/patientsex
should have been
for $ps in db:open('FAERS')/ichicsr/safetyreport/patient/patientsex
group by $s := $ps return $s || " " || count($ps)
(: 67 items - 580 sec :) let $safetyreport := db:open('FAERS')/ichicsr/safetyreport for $value in distinct-values($safetyreport/patient/patientweight ! (. div 10.0) ! round(.) ! (. * 10)) return concat($value, " ", count(index-of($safetyreport/patient/patientweight ! (. div 10.0) ! round(.) ! (. * 10), $value)))
and
for $pw in db:open('FAERS')/ichicsr/safetyreport/patientweight
for $pw in db:open('FAERS')/ichicsr/safetyreport/patient/patientweight
group by $w := $pw ! (. div 10.0) ! round(.) ! (. * 10)) return $w || " " || count($pw)