NEW

SurrealDB 4 is here, introducing SurrealDB Earth and SurrealDS!

Learn more

1/4

SURREALDB 4

The database and memory
for every agent

Starts on its first query. Speaks Postgres and MySQL.
Scales to zero instantly. Remembers in one query.

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 RELEASE, THREE FOUNDATIONS

SurrealDB 4, SurrealDB Earth and SurrealDS. Three releases for every agent and user you need: a database that speaks Postgres and MySQL, starts on its first query on Earth, and, with the default two-zone policy, acknowledges a write only once it is stored on disks in both zones, with the scale to grow when it needs to.

RELIABILITY

Compute is replaceable. Data stays durable. SurrealDS copies every write across failure domains before it is acknowledged, and a replacement node recovers from the surviving copy and object storage. SurrealDB 4 is built around stability, with more than 240 fixes that no 3.x release contains.

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 Postgres 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.

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.