NEW

SurrealDB 4 is here, introducing SurrealDB Earth and SurrealDS!

Learn more

SURREALDB 4

The next major release
of SurrealDB

SurrealDB 4 rebuilds the query core and carries 240+ fixes over 3.x.
SurrealDB Earth and SurrealDS run the same engine, from zero to massive.

Compatibility. PostgreSQL and MySQL clients connect over their own wire protocols, and MongoDB driver code runs through mql.js.
Stability. More than 240 fixes that no 3.x release contains, including more than 90 community bug reports that 3.x did not fix.
Performance. A rebuilt query core, with vector indexes built 7.4x faster and filtered vector search down from 27 ms to 1.1 ms.

ONE ENGINE, TWO WAYS TO SCALE

SurrealDB 4 is the engine. SurrealDB Earth runs it serverless across Cloudflare, one isolated database per agent. SurrealDS runs it on clusters over object storage, with each write confirmed in two zones.

RELIABILITY

Compute is replaceable. Data stays durable. SurrealDS copies each write across failure domains before confirming it, and a new node recovers from the surviving copy. SurrealDB 4 adds 240+ fixes over 3.x.

240+ fixes

More than 240 fixes to the database are in SurrealDB 4 and in no 3.x release.

90+ bug reports

More than 90 community bug reports on GitHub are fixed in SurrealDB 4 and were not fixed in 3.x.

4,500+ test files

More than 4,500 SurrealQL test files run on every change.

Two zones

With the default two-zone policy, every SurrealDS write is acknowledged only after it is stored on disks in both zones, and a replacement node recovers from the surviving copy and object storage.

PERFORMANCE

Faster at every size. A rebuilt query core in SurrealDB 4, with faster storage engines, indexes and graph traversals.

7.4x

A 1-million-vector, 768-dimension HNSW index built in 986 s instead of 7,290 s, in parallel batches on a 64-core server.

27 ms to 1.1 ms

A 1% filtered vector search, with SIMD scoring and an exact filtered tier read from the index itself.

24.5 to 9.4 min

Indexing 200,000 records of 4.2 KB with one full-text index, with index changes batched per transaction.

COMPATIBILITY

Speaks PostgreSQL and MySQL. PostgreSQL and MySQL clients, and code written for the MongoDB driver, reach the same records as SurrealQL, through one query planner.

PostgreSQL

PostgreSQL clients connect over the PostgreSQL wire protocol and run a defined subset of PostgreSQL SQL: joins, grouping, aggregates, inserts with ON CONFLICT, schema changes and transactions.
SELECT p.name,
pr.name AS product
FROM person p
JOIN bought b ON b.in = p.id
JOIN product pr ON pr.id = b.out
WHERE p.age > 30;

MySQL

MySQL clients connect over the MySQL wire protocol, and a defined subset of MySQL SQL runs through the same query planner as SurrealQL.
SELECT pr.name,
COUNT(*) AS buyers
FROM bought b
JOIN product pr ON pr.id = b.out
GROUP BY pr.name
ORDER BY buyers DESC;

MongoDB

mql.js 1.0 brings the MongoDB Node.js driver's API to SurrealDB, aggregation pipelines and Mongoose models included: change the import and the connection string.
import { MongoClient }
from "mql.js";

const client =
new MongoClient(SURREALDB_URL);
const people = client
.db("shop")
.collection("person");

await people
.find({ age: { $gt: 30 } })
.toArray();

SCALE

From zero to massive. Serverless databases that scale to zero when idle, thousands of isolated ones across Cloudflare, and clusters over very large datasets, all on SurrealDB.

Scales to zero when idle

A SurrealDB Earth database is serverless on Cloudflare's network: it starts with the first query, cold starts in ~300ms and scales to zero instantly when idle.

Thousands of instances

Earth runs thousands of isolated, persistent databases, one per user, customer or agent, with their capacity added together.

One query, many Workers

Earth splits a query across Workers and merges the answer, with every leg reading the same point in time.

Compute apart from storage

SurrealDS query nodes keep caches while data pages live in object storage, so a node joins without copying the dataset and no one shards by hand.

One query. Thousands of compute units. One answer.

A client sends a query to a coordinator, which splits it across SurrealDB Earth cells on Cloudflare. Each cell reads its share of the data from object storage, every leg reading the same point in time, and the results are merged into one answer, transactional throughout. At peak, that is 10+ billion rows per second.

A query fanning out from a coordinator across SurrealDB Earth cells to object storage

WHAT IT UNLOCKS

Data infrastructure for AI agents at any scale. One agent, one database. Thousands of agents, thousands of databases. Large platforms, shared clusters. The data model stays the same at every step.

One agent

Gets its own SurrealDB Earth database, which keeps its state between runs and uses almost no compute while the agent is idle.

Thousands of agents

Get thousands of isolated databases across Cloudflare's network, each scaling on its own, so a busy agent takes more compute than a quiet one.

Large platforms

Run groups of agents on shared SurrealDB clusters that scale out, reading and writing the same memory in transactions.

START ON SURREALDB 4

Run it today, wherever you build. Embedded in an application, on a laptop, in the browser, as a server or in SurrealDB Cloud, and as an upgrade from 3.x with every 3.x record still readable.

Your questions,answered

Yes. SurrealDB 4 speaks the PostgreSQL and MySQL wire protocols and accepts a defined subset of standard SQL, run by the same planner as SurrealQL. Joins, grouping, aggregates, ON CONFLICT, schema changes, transactions, non-recursive WITH queries (CTEs) and COPY in text and CSV all work. The information_schema and pg_catalog relations list the tables of the database, and recursive CTEs and window functions are refused, as is anything else outside the supported set, with a named error before a statement changes any data. The MySQL protocol reference in the docs describes how MySQL clients connect.

THE PLATFORM

Everything an application and its agents know. Five surfaces, one engine.

IN PRODUCTION

Trusted at scale. Samsung, Nvidia, Verizon, Tencent, and Walmart run on SurrealDB.

14,000+

Developers building on SurrealDB Cloud

4M+

Developers building on SurrealDB worldwide

FROM THE TEAMS

SurrealDB gives us a foundation where we can unify semantic search, knowledge graphs, and AI-driven decision making without stitching together multiple systems. Collapsing responsibility into SurrealDB has become our default engineering posture.
Justin Foley

VP of Engineering, Later

GET STARTED

Build on SurrealDB 4. From zero to massive: scale, performance and reliability on one database, and the foundation for AI agents.