Skip to content

Instantly share code, notes, and snippets.

@Spaider
Created December 9, 2014 12:04
Show Gist options
  • Save Spaider/26cfc0d0df6d88164f28 to your computer and use it in GitHub Desktop.
Save Spaider/26cfc0d0df6d88164f28 to your computer and use it in GitHub Desktop.
List of health-check queries for neo4j
// Number of Athletes (info)
match (:Athlete)
return count(*)
// Number of Courses (info)
match (:Course)
return count(*)
// Number of Races (info)
match (:Race)
return count(*)
// Number of MasterEvents (info)
match (:MasterEvent)
return count(*)
// Number of CoursePatterns (info)
match (:CoursePattern)
return count(*)
// Locations with no incoming relations (info)
match (l:Location)
where not ((l)<-[:LOCATED_AT]-())
return count(l)
// Master Events with non-zero Latitude but not associated with Location (warning)
match (me:MasterEvent)
where me.Latitude <> 0
and (not (me)-[:LOCATED_AT]->(:Location))
return me.MasterID, me.Latitude, me.Longitude
// Athletes with non-zero Latitude but not associated with Location (warning)
match (a:Athlete)
where a.Latitude <> 0
and (not (a)-[:LOCATED_AT]->(:Location))
return a.RacerID, a.Latitude, a.Longitude
// Missing labels where they should be (critical)
match (n)
where
labels(n) = [] and has(n.NodeType)
return count(n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment