Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@markuspf
Copy link
Contributor

@markuspf markuspf commented Oct 15, 2025

Scope & Purpose

This is an experimental feature in draft status.

This PR adds an optimizer rule that attempts to replace certain(*) 1-step-traversals by a join. The rationale is that for some (commonly encountered) queries this transformation yields good speed improvements.

The rule replaces

FOR v,e,p IN 1..1 {IN/OUT}BOUND $startVertex GRAPH $G 
   ...

by

FOR e IN edgeColl
  FILTER e._from == $startVertex
  FOR v IN vertexColl
    FILTER e._to == v._id
    LET p = { vertices: [$startVertex, v], edges: [ e ] }

This is not without challenges to get semantically equivalent, and should currently be considered incorrect and broken often. The current conditions under which this is considered correct are

  • The traversal only uses 1..1 as depth
  • The traversal involves precisely one edge collection
  • The traversal involves precisely one vertex collection
  • The traversal direction is either INBOUND or OUTBOUND
  • TODO: Combination of uniqueness levels that are permissible.
  • TODO: StartVertex can be a document or a string id; if it is a string ID, the document needs to be materialized appropriately

@cla-bot cla-bot bot added the cla-signed label Oct 15, 2025
@markuspf markuspf force-pushed the feature/short-traversal-to-join branch from 40086f2 to 229582c Compare October 17, 2025 15:25
@markuspf markuspf force-pushed the feature/short-traversal-to-join branch from 229582c to fe0a23f Compare October 23, 2025 10:09
@markuspf markuspf marked this pull request as ready for review October 23, 2025 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants