Neo4j Ops & Usage
Use for Neo4j install, Cypher, schema design, and graph ops.
Documentation & Preview
2026.x operations (verified live on 2026.10.2)
Extracted from the neo4j skill body 2026-11-16. Load when tuning memory, bulk-importing, upgrading, or doing routine maintenance.
Memory (conf/neo4j.conf; shipped defaults in parens)
server.memory.heap.initial_size(512m) /server.memory.heap.max_size(512m) — 512m heap is the binding constraint on a desktop service for big queries; raise before heavy workloads.server.memory.pagecache.size(10g) — store-file mapping.dbms.memory.transaction.total.max(256m) — all running transactions;db.memory.transaction.max(16m) — ONE transaction (note the different key prefix). A query OOM rolls back that transaction.server.jvm.additional=-XX:+ExitOnOutOfMemoryError— restart on OOM instead of limping.- Set
initial_size=max_size(same value) to avoid full-GC pauses, and always set heap + page cache explicitly (else Neo4j guesses heuristically). - Vector indexes live in OS memory, NOT the page cache — leave headroom for the OS (≈1 GB baseline, more with vector indexes) or the machine swaps.
- First-time sizing:
neo4j-admin server memory-recommendation(prints heap/pagecache recommendation + data/index sizes; verified on 2026.10.2). Rule of thumb: page cache ≈ (data + native index size) × 1.2. - Query plans cache per database (
server.memory.query_cache.per_db_cache_num_entries) — cached-plan heap grows with the number of DBs.
Bulk import (offline, the fast path)
neo4j-admin database import full — the ONLY import subcommand on 2026.x (5.x's incremental import nodes/relationships are gone).
- Server must be STOPPED; target a non-existent or empty database;
CREATE DATABASEafterwards if it didn't exist. --nodes=:Label=file.csv --relationships=:TYPE=file.csv --id-type=string|integer|actual(default string)--input-type=csv|parquet--delimiter=, --array-delimiter=; --dry-run --bad-tolerance=N --strict --overwrite-destination=true <db>.- File layout: node file = one row per node, ID column + property columns (label via the
--nodesmapping); relationship file = start-node ID columns + relationship props + end-node ID columns (type via the--relationshipsmapping). Full spec: operations manual → tools/import. - Choose: offline
import fullfor bulk loads (hours faster); onlineUNWIND/LOAD CSVfor incremental/live loads (skill section 5).
Upgrades (upgrade & migration guide, current)
- 2025–2026 CalVer series: any version → any later version = stop, replace files, start (standalone always has downtime); watch
logs/neo4j.logfor progress. - 5.26 LTS is a checkpoint: pre-5.26 must go through 5.26 first; 5.26 → any 2025-2026 is supported. LTS ≈ every 18–24 months, 3-year support window.
- NO downgrades — a failed upgrade rolls back only via pre-upgrade backup restore.
- Cypher 5 apps run unchanged on all 2025–2026 versions.
- Windows service upgrade:
neo4j windows-service uninstall→ swap the version dir →windows-service install→start.
Routine maintenance (Community, offline — stop the service first)
- Integrity:
neo4j-admin database check <db> [--check-counts --check-graph --check-indexes --check-property-owners] --report-path=<file>(verified on 2026.10.2; expensive — checks can be turned off on big DBs). - Diagnostics:
neo4j-admin server report(support zip),neo4j-admin server validate-config,neo4j-admin server memory-recommendation. - Defrag/space reclaim:
database copyis Enterprise-only (verified absent on Community) — the Community equivalent is offline dump → load into a fresh DB (rewrites the store). - Backup rules: never filesystem-copy the data directory (unsupported, corrupts stores); keep backups off-site; keep the backup dir permissions restrictive (no read or execute for other users); test restores periodically.
database migratemigrates STORE FORMATS (standard/high_limit/aligned/block) — it is not a version upgrade. - Service control needs admin:
sc stop/start neo4jfrom a non-elevated shell is Access-denied — use the UAC-elevation pattern (skill section 1).
Logs (logs/)
neo4j.log (main; upgrade progress), security.log (auth failures — first stop for login problems), query.log, debug.log, http.log. The Windows service wrapper adds service-out.log, service-error.log, neo4j-service.<date>.log.
Timeouts & security posture (live-verified 2026-11-16)
db.transaction.timeoutSHIPS DISABLED (0s) — set a positive default (e.g.,db.transaction.timeout=10s) in neo4j.conf so runaway queries can't hang the server. Dynamic override:dbms.setConfigValue('db.transaction.timeout','10s').db.lock.acquisition.timeout(also 0s default) bounds lock waits.- Keep
server.default_listen_addressatlocalhostfor desktop (Bolt not exposed off-machine; live-verified).dbms.security.auth_enabledis true by default — keep it.