Last active
January 15, 2018 16:10
-
-
Save danodonovan/1adf3d78cd1e15a963c33d295fb3f345 to your computer and use it in GitHub Desktop.
Handy Neo4j Queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// count all node labels | |
MATCH (n) | |
RETURN labels(n), count(DISTINCT n); | |
// describe metagraph | |
CALL db.schema(); | |
// list node stats | |
// Sample some nodes, reporting on property and relationship counts per node. | |
MATCH (n) WHERE rand() <= 0.1 | |
RETURN | |
DISTINCT labels(n), | |
count(*) AS SampleSize, | |
avg(size(keys(n))) as Avg_PropertyCount, | |
min(size(keys(n))) as Min_PropertyCount, | |
max(size(keys(n))) as Max_PropertyCount, | |
avg(size( (n)-[]-() ) ) as Avg_RelationshipCount, | |
min(size( (n)-[]-() ) ) as Min_RelationshipCount, | |
max(size( (n)-[]-() ) ) as Max_RelationshipCount |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Switch to queries defined in the Neo4j browser