diff --git a/modules/ROOT/pages/indexes/search-performance-indexes/managing-indexes.adoc b/modules/ROOT/pages/indexes/search-performance-indexes/managing-indexes.adoc index f26786197..189cd8b64 100644 --- a/modules/ROOT/pages/indexes/search-performance-indexes/managing-indexes.adoc +++ b/modules/ROOT/pages/indexes/search-performance-indexes/managing-indexes.adoc @@ -42,7 +42,7 @@ Creating an index requires link:{neo4j-docs-base-uri}/operations-manual/{page-ve A newly created index is not immediately available but is created in the background. [[create-range-index]] -=== Creating a range index +=== Create a range index Creating a range index can be done with the `CREATE INDEX` command. Note that the index name must be unique. @@ -200,7 +200,7 @@ FOR (n:Person) ON (n.surname) The index will not be created if there already exists an index with the same schema and type, same name or both. [[create-text-index]] -=== Creating a text index +=== Create a text index Creating a text index can be done with the `CREATE TEXT INDEX` command. Note that the index name must be unique. @@ -365,7 +365,7 @@ OPTIONS {indexProvider: 'text-2.0'} There is no supported index configuration for text indexes. [[create-point-index]] -=== Creating a point index +=== Create a point index Creating a point index can be done with the `CREATE POINT INDEX` command. Note that the index name must be unique. @@ -519,7 +519,7 @@ OPTIONS { Note that the wgs-84 and 3D cartesian settings, which are not specified in this example, will be set with their respective default values. [[create-lookup-index]] -=== Creating a token lookup index +=== Create a token lookup index Two token lookup indexes are created by default when creating a Neo4j database (one node label lookup index and one relationship type lookup index). Only one node label and one relationship type lookup index can exist at the same time. diff --git a/modules/ROOT/pages/indexes/search-performance-indexes/using-indexes.adoc b/modules/ROOT/pages/indexes/search-performance-indexes/using-indexes.adoc index 641df1535..cc2faad7f 100644 --- a/modules/ROOT/pages/indexes/search-performance-indexes/using-indexes.adoc +++ b/modules/ROOT/pages/indexes/search-performance-indexes/using-indexes.adoc @@ -553,7 +553,7 @@ Additionally, it bears repeating that composite indexes can only be used if a pr [[range-index-backed-order-by]] == Range index-backed ORDER BY -Range indexes store properties in ascending order (alphabetically for `STRING` values, and numerically for other `FLOAT` and `INTEGER` values). +Range indexes store properties in ascending order (alphabetically for `STRING` values, and numerically for `FLOAT` and `INTEGER` values). This can have important implications for query performance, because the planner may be able to take advantage of a pre-existing index order and therefore not have to perform an expensive xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-sort[`Sort`] operation later in the query. To demonstrate this behavior, the following query will filter out any `ROUTE` relationships with a `distance` property less than `30`, and return the `distance` property of the matched relationships in ascending numerical order using the xref:clauses/order-by.adoc[ORDER BY] clause. @@ -571,28 +571,26 @@ ORDER BY distance .Execution plan [role="queryplan"] ---- -+-----------------+----+--------------------------------+----------------+-------+---------+----------------+------------------------+-----------+--------------+---------------------+ -| Operator | Id | Details | Estimated Rows | Rows | DB Hits | Memory (Bytes) | Page Cache Hits/Misses | Time (ms) | Ordered by | Pipeline | -+-----------------+----+--------------------------------+----------------+-------+---------+----------------+------------------------+-----------+--------------+---------------------+ -| +ProduceResults | 0 | distance | 3013 | 6744 | 0 | 0 | 0/0 | 12.784 | | | -| | +----+--------------------------------+----------------+-------+---------+----------------+------------------------+-----------+ | | -| +Sort | 1 | distance ASC | 3013 | 6744 | 0 | 540472 | 0/0 | 50.600 | distance ASC | In Pipeline 1 | -| | +----+--------------------------------+----------------+-------+---------+----------------+------------------------+-----------+--------------+---------------------+ -| +Projection | 2 | cache[r.distance] AS distance | 3013 | 6744 | 0 | | | | | | -| | +----+--------------------------------+----------------+-------+---------+----------------+ | +--------------+ | -| +Filter | 3 | cache[r.distance] < $autoint_0 | 3013 | 6744 | 10041 | | | | | | -| | +----+--------------------------------+----------------+-------+---------+----------------+ | +--------------+ | -| +Expand(All) | 4 | (anon_0)-[r:ROUTE]-(anon_1) | 10044 | 10041 | 151992 | | | | | | -| | +----+--------------------------------+----------------+-------+---------+----------------+ | +--------------+ | -| +AllNodesScan | 5 | anon_0 | 69165 | 69165 | 69166 | 376 | 31116/0 | 200.706 | | Fused in Pipeline 0 | -+-----------------+----+--------------------------------+----------------+-------+---------+----------------+------------------------+-----------+--------------+---------------------+ - -Total database accesses: 231199, total allocated memory: 540808 ++---------------------------------+----+--------------------------------+----------------+-------+---------+----------------+------------------------+-----------+--------------+---------------------+ +| Operator | Id | Details | Estimated Rows | Rows | DB Hits | Memory (Bytes) | Page Cache Hits/Misses | Time (ms) | Ordered by | Pipeline | ++---------------------------------+----+--------------------------------+----------------+-------+---------+----------------+------------------------+-----------+--------------+---------------------+ +| +ProduceResults | 0 | distance | 3013 | 6744 | 0 | 0 | 0/0 | 14.397 | | | +| | +----+--------------------------------+----------------+-------+---------+----------------+------------------------+-----------+ | | +| +Sort | 1 | distance ASC | 3013 | 6744 | 0 | 540472 | 0/0 | 16.844 | distance ASC | In Pipeline 1 | +| | +----+--------------------------------+----------------+-------+---------+----------------+------------------------+-----------+--------------+---------------------+ +| +Projection | 2 | cache[r.distance] AS distance | 3013 | 6744 | 0 | | | | | | +| | +----+--------------------------------+----------------+-------+---------+----------------+ | +--------------+ | +| +Filter | 3 | cache[r.distance] < $autoint_0 | 3013 | 6744 | 10041 | | | | | | +| | +----+--------------------------------+----------------+-------+---------+----------------+ | +--------------+ | +| +UndirectedRelationshipTypeScan | 4 | (anon_0)-[r:ROUTE]-(anon_1) | 10044 | 10041 | 5023 | 376 | 84/0 | 22.397 | | Fused in Pipeline 0 | ++---------------------------------+----+--------------------------------+----------------+-------+---------+----------------+------------------------+-----------+--------------+---------------------+ + +Total database accesses: 15064, total allocated memory: 540808 ---- This plan shows two important points about indexes and the ordering of results: -* No index was used in this query. +* Only the relationship type lookup index was used in this query (accessed by the xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-undirected-relationship-type-scan[`UndirectedRelationshipTypeScan`] operator, which fetches all relationships and their start and end nodes from the relationship type index). * As a result, the planner has to perform a `Sort` operation to order the results by the distance property (in this case, it required 540472 bytes of memory). To see how an index could impact the query plan, it is first necessary to create a range index on the `distance` property: diff --git a/modules/ROOT/pages/indexes/syntax.adoc b/modules/ROOT/pages/indexes/syntax.adoc index 52cf1d6b7..b1a410be0 100644 --- a/modules/ROOT/pages/indexes/syntax.adoc +++ b/modules/ROOT/pages/indexes/syntax.adoc @@ -61,6 +61,8 @@ ON (r.propertyName_1[, r.propertyName_n]) ---- +For more information, see xref:indexes/search-performance-indexes/managing-indexes.adoc#create-range-index[Create, show, and delete indexes -> Create a range index]. + [[create-text-index]] === Text indexes @@ -87,6 +89,8 @@ Text indexes have no supported index configuration and, as of Neo4j 5.1, they ha [NOTE] It is not possible to create composite text indexes on multiple properties. +For more information, see xref:indexes/search-performance-indexes/managing-indexes.adoc#create-text-index[Create, show, and delete indexes -> Create a text index]. + [[create-point-index]] === Point indexes @@ -123,6 +127,7 @@ The following settings can be specified for point indexes: [NOTE] It is not possible to create composite point indexes on multiple properties. +For more information, see xref:indexes/search-performance-indexes/managing-indexes.adoc#create-point-index[Create, show, and delete indexes -> Create a point index]. [[create-lookup-index]] === Token lookup indexes @@ -148,6 +153,8 @@ ON [EACH] type(r) Two token lookup indexes are present by default when creating a Neo4j database, and only one node label lookup index and one relationship type lookup index can exist at the same time. +For more information, see xref:indexes/search-performance-indexes/managing-indexes.adoc#create-lookup-index[Create, show, and delete indexes -> Create a token lookup index]. + [[create-full-text-index]] === Full-text indexes @@ -176,6 +183,8 @@ The following settings can be specified for full-text indexes: * `fulltext.eventually_consistent` - specifies whether a full-text index is eventually consistent. If set to `true`, it will ensure that updates from committing transactions are applied in a background thread. +For more information, see xref:indexes/semantic-indexes/full-text-indexes.adoc#create-full-text-indexes[Full-text indexes - Create full-text indexes]. + [[create-vector-index]] === Vector indexes @@ -204,6 +213,8 @@ OPTIONS { [NOTE] It is not possible to create composite vector indexes on multiple properties. +For more information, see xref:indexes/semantic-indexes/vector-indexes.adoc#indexes-vector-create[Vector indexes - Create and configure vector indexes]. + [[list-index]] == SHOW INDEX @@ -221,6 +232,8 @@ SHOW [ALL | FULLTEXT | LOOKUP | POINT | RANGE | TEXT | VECTOR] INDEX[ES] When using the `RETURN` clause, the `YIELD` clause is mandatory. +For more information, see xref:indexes/search-performance-indexes/managing-indexes.adoc#list-indexes[Create, show, and delete indexes -> SHOW INDEXES]. + [[query-semantic-indexes]] == Query semantic indexes @@ -250,6 +263,8 @@ The valid _key: value_ pairs for the `options` map are: The `options` map and all of the keys are optional. +For more information, see xref:indexes/semantic-indexes/full-text-indexes.adoc#query-full-text-indexes[Full-text indexes - Query full-text indexes]. + [[query-vector-index]] === Vector indexes @@ -262,6 +277,8 @@ CALL db.index.vector.queryNodes(indexName :: STRING, numberOfNearestNeighbours : The `numberOfNearestNeighbours` refers to the number of nearest neighbors to return as the neighborhood. The `query` vector refers to the `LIST` in which to search for the neighborhood. +For more information, see xref:indexes/semantic-indexes/vector-indexes.adoc#indexes-vector-query[Vector indexes - Query vector indexes]. + [[drop-index]] == DROP INDEX @@ -280,3 +297,5 @@ Dropping indexes requires link:{neo4j-docs-base-uri}/operations-manual/{page-ver ---- DROP INDEX index_name [IF EXISTS] ---- + +For more information, see xref:indexes/search-performance-indexes/managing-indexes.adoc#drop-indexes[Create, show, and delete indexes -> DROP INDEX]. \ No newline at end of file