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)
-- The information in this email and any attachments are intended solely for the recipient(s) to whom it is addressed, and may be confidential and/or privileged. Any unauthorized distribution or copying of this transmittal or its attachments is prohibited. If you are not a named recipient or have received this email in error: (i) you should not read, disclose, or copy it, (ii) please notify the sender of your receipt by reply email and delete this email and all attachments.