Skip to content

Global edge index documentation #1253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions pages/fundamentals/indexes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,30 @@ Named parameters are not supported for edge-type property indexes.

</Callout>

### Global edge property index

Since edges can have only one edge type, Memgraph provides a way to index all the edges that contain
a certain property via the global edge index. The syntax to index all the edges that have a certain property is
the following:

```cypher
CREATE GLOBAL EDGE INDEX ON :(property_name);
```

Creating a global edge property index will optimize the following type of queries:

```cypher
MATCH ()-[r {property_name: value}]->() RETURN r;
```

<Callout type="info">

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.

</Callout>

### Point index

Point index can be utilized for more performant spatial queries which use `WHERE point.distance()` or `WHERE point.withinbbox()`.
Expand Down Expand Up @@ -447,6 +471,14 @@ DROP INDEX ON :Label(property1, property2);
DROP EDGE INDEX ON :EDGE_TYPE;
```

```cypher
DROP EDGE INDEX ON :EDGE_TYPE(property_name);
```

```cypher
DROP GLOBAL EDGE INDEX ON :(property_name);
```

These queries instruct all active transactions to abort as soon as possible.
Once all transactions have finished, the index will be deleted.

Expand Down