APOC Toolbelt

apoc.periodic.iterate, apoc.load.json, apoc.cypher.run — the standard-library extension.

0/4 done

Overview

APOC Toolbelt

apoc.periodic.iterate, apoc.load.json, apoc.cypher.run — the standard-library extension.

Why it matters

APOC ships the procedures Cypher itself doesn't include — large-batch writes (periodic.iterate), external IO (load.json / load.csv), schema utilities.

Going deeper

APOC (Awesome Procedures On Cypher) ships procedures Cypher itself doesn't include. The flagship is batched writes:

CALL apoc.periodic.iterate(
  'MATCH (o:Order) WHERE o.normalized IS NULL RETURN o',
  'SET o.normalized = true',
  {batchSize: 5000, parallel: false}
);

The outer query streams the work; the inner query runs per batch in its own transaction, so a multi-million-row update stays within heap. Other staples: apoc.load.json / apoc.load.csv for external IO, apoc.cypher.run for dynamic Cypher, and graph-refactoring helpers.

Modern Neo4j has folded some of this into core Cypher (CALL { } IN TRANSACTIONS now covers many periodic.iterate cases). Reach for native Cypher first; use APOC where the core still has a gap, and pin the APOC version to your DB version.

Analogy

APOC is the standard-library import you reach for the moment the language core runs out. Cypher gives you the syntax; APOC gives you periodic.iterate for industrial-scale batch writes, load.json/load.csv for getting data in, and dozens of utilities — the 'batteries' the core deliberately leaves out.

Pitfalls — what breaks when this is weak

  • parallel: true on overlapping writes. Deadlocks/lost updates. Fix: keep parallel off unless batches are disjoint.
  • Version skew. APOC must match the DB major version. Fix: pin compatible versions.
  • Reaching for APOC when core Cypher now suffices. Fix: prefer IN TRANSACTIONS for batching where it fits.

Make it stick

Use the prompts below to anchor apoc toolbelt to a real graph you own.

  • Which batch operation in your system uses APOC where core `IN TRANSACTIONS` would now do?
  • Is your APOC version pinned to your Neo4j version in deployment?
  • Where might `parallel: true` be risking write conflicts today?

Reading in progress · 0 of 4 activities done