Skip to content
Create a gist now

Instantly share code, notes, and snippets.

start t=node:types(id={id})
match
(t)<-[:has_type]-(u)<-[:metric_unit]-(ma)<-[:metric_activity]-(m)<-[cm:cycle_metric]-(c)
where
c.measureDate>={measureStartDate} and c.measureDate <= {measureEndDate}
with distinct m, ma, u, c
match
(u)<-[:alert_for_unit]-(a)
where
a.alertDate=c.measureDate and a.fromEntityType={type}
with a,ma,u
match
(i)-[:has_result]->(ir)<-[:for_inspection_result]-(a)
where
(i)<-[:metric_inspection]-(ma)
and (a)-[:alert_for_inspection]->(i)
return ir.value as alertValue, count(ir.value) as alertCount, u.id as unitId, u.name as unitName
@jexp
jexp commented Jan 3, 2013

The distinct in line 6 kills the query lazyness and also performance, how does it perform if you leave that off?

@luanne
Owner
luanne commented Jan 11, 2013

It does perform better, but I do believe I need that distinct- it is worth a second look though to confirm that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.