diff --git a/pages/fundamentals/indexes.mdx b/pages/fundamentals/indexes.mdx index 7534323e9..56b0fb631 100644 --- a/pages/fundamentals/indexes.mdx +++ b/pages/fundamentals/indexes.mdx @@ -151,7 +151,43 @@ Creating an edge-type index will optimize the following type of queries: MATCH ()-[r:EDGE_TYPE]->() RETURN r; ``` -#### Analyze graph + + +If you need to access nodes of found edges, you can use the `startNode(r)` and `endNode(r)` functions. + +Named parameters are not supported for edge-type indexes. + + + +### Edge-type property index + +To optimize queries that fetch only the edges by specific edge types and properties, you need to create an edge-type property index. + + + +Creating an edge-type property index requires the --storage-properties-on-edges flag to be set to true! + + + +```cypher +CREATE EDGE INDEX ON :EDGE_TYPE(property_name); +``` + +Creating an edge-type property index will optimize the following type of queries: + +```cypher +MATCH ()-[r:EDGE_TYPE {property_name: value}]->() RETURN r; +``` + + + +If you need to access nodes of found edges, you can use the `startNode(r)` and `endNode(r)` functions. + +Named parameters are not supported for edge-type property indexes. + + + +### Analyze graph When multiple label-property indexes exist, the database can sometimes select a non-optimal index due to the data's distribution. @@ -310,7 +346,7 @@ configuration](/configuration/configuration-settings#storage) flag to `true`. ### Analyze graph The `ANALYZE GRAPH` will check and calculate certain properties of a graph so -that the database can choose a more optimal index or `MERGE` transaction. +that the database can choose a more optimal index or `MERGE` transaction. Before the introduction of the `ANALYZE GRAPH` query, the database would choose an index solely based on the number of indexed nodes. But if the number of nodes @@ -418,14 +454,14 @@ It is also possible to specify multiple hints separated with comma. In that case, the planner will apply the first hint that is applicable for a given match. -An example of selecting an index with `USING INDEX`: +An example of selecting an index with `USING INDEX`: ``` USING INDEX :Person(name) MATCH (n:Person {name: 'John', gender: 'male'}) RETURN n; ``` - + Overriding planner behavior with index hints should be used with caution, and only by experienced developers and/or database administrators, as poor index