Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Neo4j Create Index

  • Last Updated : 06 Jun, 2021

In neo4j you can create index for both property and nodes. Indexing is data structure that helps faster performance on retrieval operation on database. There is special features in neo4j indexing once you create indexing that index will manage itself and keep it up to date whenever changes made on the database. Similarly CREATE INDEX ON statement will provide the indexing. 

Example: In the below example we create index on the Tag property of all nodes with the GeeksforGeeks label. 

$ CREATE INDEX ON:GeeksforGeeks(Tag)
  • Output: 

  • Note: 
    When you create an index, neo4j will create the index in background. If your database is large it will take some time. 

View Index: 
Index and Constraint is the part of the database schema. To view the indexes you have to use :schema command, like below example. 

  • Output: 


Index hints: 
If the indexing is exist on your database then it will be helpful when you trigger similar type of queries, it improves the performance. You can create an index hint by including USING INDEX … in your query. 

$ MATCH (a:GeeksforGeeks {Tag: "A Computer Science Portal"}) 
USING INDEX a:GeeksforGeeks(Tag) 
  • Output: 

    Note: You can also provide multiple hints. Simply add a new USING INDEX for each index you’d like to enforce.


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!