Skip to content

Commit 6d75171

Browse files
Josipmrdenmatea16
andauthored
Global edge index documentation (#1253)
* Add global edge index documentation * Add dropping of global edge index * Apply suggestions from code review * update --------- Co-authored-by: Matea Pesic <80577904+matea16@users.noreply.github.com> Co-authored-by: matea16 <mateapesic@hotmail.com>
1 parent 36b0f26 commit 6d75171

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

pages/fundamentals/indexes.mdx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,30 @@ Named parameters are not supported for edge-type property indexes.
306306

307307
</Callout>
308308

309+
### Global edge property index
310+
311+
Since edges can have only one edge type, Memgraph provides a way to index all the edges that contain
312+
a certain property via the global edge index. The syntax to index all the edges that have a certain property is
313+
the following:
314+
315+
```cypher
316+
CREATE GLOBAL EDGE INDEX ON :(property_name);
317+
```
318+
319+
Creating a global edge property index will optimize the following type of queries:
320+
321+
```cypher
322+
MATCH ()-[r {property_name: value}]->() RETURN r;
323+
```
324+
325+
<Callout type="info">
326+
327+
If you need to access nodes of found edges, you can use the `startNode(r)` and `endNode(r)` functions.
328+
329+
Named parameters are not supported for edge-type property indexes.
330+
331+
</Callout>
332+
309333
### Point index
310334

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

474+
```cypher
475+
DROP EDGE INDEX ON :EDGE_TYPE(property_name);
476+
```
477+
478+
```cypher
479+
DROP GLOBAL EDGE INDEX ON :(property_name);
480+
```
481+
450482
These queries instruct all active transactions to abort as soon as possible.
451483
Once all transactions have finished, the index will be deleted.
452484

0 commit comments

Comments
 (0)