Neo4j Create Index

In Neo4j, index is a data structure which is used to improve the speed of data retrieval operations in a database.

An index can be created over a property on any node that has been given a label. Once an index is created, Neo4j will manage it and keep it up to date whenever the database is changed.

CREATE INDEX ON statement is used to create an index.

Example:

Output:

Neo4j Create index 1

Note: Every time you create an index Neo4j will create the index in the background. If your database is large, this may take some time. Only when Neo4j has finished creating the index, will it be brought online, and it can be used in queries.

Verification

The created schema and constraints become the part of database schema. You can check all indexes and constraints by using the :schema command.

Output:

Neo4j Create index 2




Latest Courses