Skip to main content

batch_pass_admission

Function batch_pass_admission 

Source
pub fn batch_pass_admission(query: &Query) -> bool
Expand description

Whether an IN TRANSACTIONS body takes the batch pass (ADR-0669): one clause-engine pass per batch instead of one nested invocation per row. Plan-time over the body’s IR, so the plan node renders the execution strategy in its details. Whether an IN TRANSACTIONS body takes the batch pass (ADR-0669): a single flat part, no NEXT stage, non-projecting, with no WITH and no schema/admin DDL among its own clauses. Everything else about the body runs in the pass exactly as its clause list would in a plain statement over the batch’s seed rows — MATCH, procedure CALL, nested CALL { … }, conditionals, graph-reading expressions included: pipeline order, one clause-engine invocation and one nested-budget tick per batch, the per-row statement-engine loop never entered. The batch commits per batch either way (ADR-0210); what the pass removes is the per-row invocation, which is pure overhead — the caller already named the batch.

The exclusions are structural, not semantic preferences:

  • a WITH-carrying body needs the importing-scope re-attach (run_nested_clauses_scoped), which re-attaches one scope row per nested invocation — per-row by construction. The legacy importing-WITH form keeps the per-row path with it;
  • a projecting body (a trailing clause the canonical table says spills rows — [body_projects_rows], the same classification the per-row merge consults, never inferred from the clause set) merges each body row back onto its originating outer row, a lineage the pass does not track. A terminal LOAD CSV projects and stays per-row with it.
  • schema/admin DDL has no per-row work to batch and stays per-row.

The pass gives up Neo4j’s per-row read-after-write interleaving — the body evaluates the batch as a unit. That decision, its within-clause coincidence and the smaller-batch remedy are recorded once in ADR-0669.