Knowledge Base

Why do my deleted property keys appear?

When using the Neo4j Browser and selecting the left frame and top icon entitled Database Information or using the built in stored procedure db.propertyKeys() you may see property keys which are no longer associated with any nodes. This is expected. For example, using the Neo4j Browser and connecting to an empty graph, if one then runs :play movies one can populate the graph with a sample dataset. After the graph is populated if one then runs match (n) detach delete n; this will remove all nodes/relationships from the graph.
However both the Browser and the stored procedure will display the property keys from the movie graph, regardless if they are associated with any nodes, for example

Unlike labels and relationship types which have underlying meta-data that report the number of objects for each, there is no meta-data for property keys.

If you need to remove the property keys your options are either

  1. recreate the graph


  2. use which is an offline process to read a graph.db and copy its (contents, nodes, relationships) to a new graph.db and only include propertyKeys associated with nodes