public
Last active

  • Download Gist
Query2_optimized.sql
SQL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
start c=node:companies(id={id})
match
c<-[:parent_company*0..]-n
with n
match
n-[:defines_business_process]->bp-[:has_cycle]->cm
where
cm.measureDate>={measureStartDate} and cm.measureDate<={measureEndDate}
with cm
match
(cm)-[:cycle_metric]->m-[:metric_activity]->ma-[:metric_unit]->u<-[:alert_for_unit]-(a)
where
a.alertDate=cm.measureDate and a.fromEntityType={type}
with a,ma
match
(r)<-[:for_inspection_result]-a-[:alert_for_inspection]->i
where
(i)<-[:metric_inspection]-(ma)
return a.id as alertId, r.value as resultValue

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.