Use apoc.meta.stats() from APOC Procedures to find different counts in the Neo4j database

APOC Procedures offer meta procedures that provide access to comprehensive count store data in a single operation. One such procedure is apoc.meta.stats(), which retrieves the information stored in the transactional database statistics. You have the flexibility to select the specific data you wish to display from the results of the apoc.meta.stats() call.

The apoc.meta.stats() call yields the following values:

  • labelCount: The number of labels in the graph.
CALL apoc.meta.stats() YIELD labelCount
RETURN labelCount
  • relTypeCount: The number of relationship types in the graph.
CALL apoc.meta.stats() YIELD relTypeCount 
RETURN relTypeCount 
  • propertyKeyCount: The number of property keys in the graph.
CALL apoc.meta.stats() YIELD propertyKeyCount
RETURN propertyKeyCount
  • nodeCount: The number of total nodes in the graph.
CALL apoc.meta.stats() YIELD nodeCount
RETURN nodeCount
  • relCount: The number of total relationships in the graph.
CALL apoc.meta.stats() YIELD relCount
RETURN relCount
  • labels: A map of each label with the count of nodes of that label.
CALL apoc.meta.stats() YIELD labels
RETURN labels
  • relTypes: A map of each relationship pattern and their associated count.
CALL apoc.meta.stats() YIELD relTypes
RETURN relTypes
  • relTypesCount: A map of each relationship type and the counts for that type.
CALL apoc.meta.stats() YIELD relTypesCount
RETURN relTypesCount

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.