8000 perf: push-down not/not-join clauses to earliest valid position · Issue #248 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

perf: push-down not/not-join clauses to earliest valid position #248

Closed

Description

@adityamukho

Roadmap source

Post-1.0 Performance Backlog — follow-up from Wave 2 PR 1 (#207/#206 design).

Problem

Not and NotJoin clauses are currently applied as a final post-filter after all positive pattern matching completes. If a not clause's join variables are all bound after pattern 2 of 5, the full binding set is carried through patterns 3–5 before the negation filter reduces it.

Proposed fix

Extend optimizer::plan() to position Not/NotJoin clauses at the earliest valid position where all their join variables are bound by preceding patterns — analogous to the Expr push-down added in #207.

Context

The plan() refactor in #207 (Wave 2 PR 1) extends the planner to handle WhereClause::Expr push-down. The same mechanism can be extended to Not/NotJoin in a follow-up. The groundwork is already in place after that PR lands.

Acceptance criteria

  • Not/NotJoin clauses are inserted in the plan at the earliest position where all join variables are bound.
  • Semantics are preserved: a not clause with partially-unbound variables is never evaluated early.
  • Existing stratification and safety behaviour is unchanged.
  • Tests for: not clause pushed early, not clause with unbound vars stays at end, not-join pushed to correct position.
  • Benchmark showing reduction in intermediate binding set size.

Prerequisites

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0