TuringDB home pagelight logodark logo
  • Discord
  • GitHub
  • Website
TuringDB

Get Started

  • Introduction
  • Get Started
  • Claude Code Skill
  • Commands

Concepts

  • Overview
  • A Columnar Graph Database
  • Versioning System
  • The DataPart System
  • Zero-Locking Architecture
  • Snapshots Isolation

Benchmarks

  • Results Summary
  • Technical Report

Query Language

  • Overview
  • Matching
  • Paths
  • Results and Aggregation
  • NEXT and WHEN
  • Subqueries
  • Functions and Types
  • Writing Data
  • Procedures and Commands
  • CheatSheet

Importing data

  • JSONL
  • CSV
  • Neo4j
  • GML
  • Parquet

Graph Development

  • Create Graph
  • Load Graph
  • Load External data
  • Create a Change
  • List Changes
  • Create Nodes and Edges
  • Update Properties
  • Submit a Change
  • Time Travel
  • Graph Examples

Vector Search

  • Vector Search

Graph Algorithms

  • Shortest Path

Tutorials

  • Example Notebooks

Python SDK

  • Get Started
  • Reference

JavaScript SDK

  • Get Started
  • Reference

Release Notes

  • All Releases
  • TuringDB 3.1

Troubleshooting

  • Troubleshooting

  • About db.history()
  • Lazy Commit Loading
  • Example: Querying a past commit from the JavaScript SDK
Graph Development

Time Travel

You can time travel in you graph databases and see the commit history

  • Cypher
  • Python SDK
// Show commit history
CALL db.history()

// Read a previous commit
checkout c0a6ce3c0315be7a

// Query graph at specific commit
MATCH (n:Person)-[e:KNOWS]->(m:Person)
WHERE n.name = 'Jane'
AND m.name = 'John'
RETURN n, e, m
# Show commit history
client.query("CALL db.history()")

# Read a previous commit
client.checkout(change="main", commit="c0a6ce3c0315be7a")

# Query graph at specific commit
client.query("""
MATCH (n:Person)-[e:KNOWS]->(m:Person)
WHERE n.name = 'Jane'
AND m.name = 'John'
RETURN n, e, m
""")

​
About db.history()

  • Commits are listed newest first, and the latest one is marked with a literal (HEAD) suffix on its hash: strip it before passing the hash to checkout.
  • Every COMMIT and every submitted change adds an entry.
  • nodeCount and edgeCount count what that commit added, not the graph totals.
  • Use hashes exactly as printed (they are not zero-padded). An unknown hash returns COMMIT_NOT_FOUND from client.checkout(commit=...), and zeros from CALL db.describeCommit('<hash>').
  • A past commit is read-only, so make writes on main or in a change. Call client.checkout() to return to main.

​
Lazy Commit Loading

TuringDB lazily loads commits from disk. When a graph is loaded, only the HEAD commit (the latest commit on the current branch) is fully loaded into memory. All other commits are registered but their data remains on disk until explicitly requested.

This means that to query a past commit, its data must first be loaded into memory using the LOAD COMMIT command:

LOAD COMMIT 'c0a6ce3c0315be7a'

When do I need LOAD COMMIT?

  • TuringDB shell: The checkout command automatically loads the commit for you — no need to call LOAD COMMIT manually.
  • Python SDK: client.checkout(commit=...) automatically loads the commit for you. client.set_commit(...) does not, so call LOAD COMMIT first when you use it.
  • JavaScript SDK: You must call LOAD COMMIT '<hash>' before querying a past commit with setCommit() or the commit option, unless the commit was created since the server started.

​
Example: Querying a past commit from the JavaScript SDK

// Step 1: Load the commit into memory
await client.query("LOAD COMMIT 'be9643a1c03f8e2b'");

// Step 2: Now you can query at that commit
const rows = await client.queryData(
    "MATCH (n:Person)-[e:KNOWS]->(m:Person) " +
    "RETURN n.name, m.name",
    { commit: "be9643a1c03f8e2b" },
);

If you try to query a commit that has not been loaded, TuringDB will return a COMMIT_NOT_LOADED error: Commit 'be9643a1c03f8e2b' is not loaded to memory - use LOAD COMMIT 'be9643a1c03f8e2b' to load it

LOAD COMMIT is idempotent — calling it on an already-loaded commit is a no-op and returns immediately.

Submit a ChangeGraph Examples
githublinkedinyoutubediscord