- Neo4j CQL Write Clauses
- Neo4j - Merge Command
- Neo4j - Set Clause
- Neo4j - Delete Clause
- Neo4j - Remove Clause
- Neo4j - Foreach Clause
- Neo4j CQL Read Clause
- Neo4j - Match Clause
- Neo4j - Optional Match Clause
- Neo4j - Where Clause
- Neo4j - Count Function
- Neo4j CQL General Clauses
- Neo4j - Return Clause
- Neo4j - Order By Clause
- Neo4j - Limit Clause
- Neo4j - Skip Clause
- Neo4j - With Clause
- Neo4j - Unwind Clause
- Neo4j CQL Functions
- Neo4j - String Functions
- Neo4j - Aggregation Function
- Neo4j CQL Admin
- Neo4j - Backup & Restore
- Neo4j - Index
- Neo4j - Create Unique Constraint
- Neo4j - Drop Unique
- Neo4j Useful Resources
- Neo4j - Quick Guide
- Neo4j - Useful Resources
- Neo4j - Discussion
Neo4j CQL - Index
Neo4j SQL supports Indexes on Node or Relationships properties to improve the performance of the application.
We can create indexes on properties for all nodes which have same label name.
We can use these indexed columns on MATCH or WHERE or IN operator to improve the execution of CQL Command.
Neo4J Index operations
- Create Index
- Drop Index
We will discuss these operations with examples in this chapter.
Create Neo4j Index
Neo4j CQL has provided "CREATE INDEX" command to create indexes on NODE's or Relationship's properties.
Create Index syntax:
CREATE INDEX ON :<label_name> (<property_name>)
NOTE:-
The colon(:) operator is used to refer a Node or a Relationship label name.
The above syntax describes that it creates a new index on <property_name> of <label_name> of a Node or a Relationship.
Example -
This example demonstrates how to Create INDEX on number property of a CreditCard Node.
Step 1 - Type the below command on Data Browser
CREATE INDEX ON :Customer (name)
Step 2 - Click on "Execute" button and observe the results.
It shows that one new Index is added to the Neo4j Database
Drop Neo4j Index
Neo4j CQL has provided "DROP INDEX" command to drop an existing index of a NODE's or Relationship's property.
Drop Index syntax:
DROP INDEX ON :<label_name> (<property_name>)
NOTE:-
The colon(:) operator is used to refer a Node or a Relationship label name.
The above syntax describes that it drops an existing index created on <property_name> of <label_name> of a Node or a Relationship.
Example -
This example demonstrates how to drop an INDEX on number property of a CreditCard Node.
Steps to follow:
Step 1 - Type the below command on Data Browser
DROP INDEX ON :Customer (name)
Step 2 - Click on "Execute" button and observe the results.
It shows that one Index is dropped from the Neo4j Database