Knowledge Base

How to get a high level inventory of objects in your graph

The following Cypher can be used to get a simple high level view of the number of objects within your graph database. This may be used if one is trying to compare the contents of two databases:

match (n) return 'Number of Nodes: ' + count(n) as output UNION
match ()-[]->() return 'Number of Relationships: ' + count(*) as output UNION
CALL db.labels() YIELD label RETURN 'Number of Labels: ' + count(*) AS output UNION
CALL db.relationshipTypes() YIELD relationshipType  RETURN 'Number of Relationships Types: ' + count(*) AS output UNION
CALL db.propertyKeys() YIELD propertyKey  RETURN 'Number of Property Keys: ' + count(*) AS output UNION
CALL db.constraints() YIELD description RETURN 'Number of Constraints:' + count(*) AS output UNION
CALL db.indexes() YIELD description RETURN 'Number of Indexes: ' + count(*) AS output UNION
CALL dbms.procedures() YIELD name RETURN 'Number of Procedures: ' + count(*) AS output

To which sample output is as follows:

Number of Nodes: 50013
Number of Relationships: 4
Number of Labels: 4
Number of Relationships Types: 2
Number of Property Keys: 9
Number of Constraints:2
Number of Indexes: 7
Number of Procedures: 215