Back to Devoured - November 05, 2026
DEVOURED
SurrealDB 4

SurrealDB 4

Data SurrealDB
SurrealDB 4 launches with a rebuilt query engine and native wire protocol support for PostgreSQL, MySQL, and MongoDB.
What: The major release features 240+ bug fixes and significant performance gains, including 42% faster CRUD operations and 22x faster indexed queries. It introduces 'SurrealDB Earth' for serverless deployments on Cloudflare and distributed clusters with multi-zone write consistency.
Why it matters: By adopting standard wire protocols, SurrealDB is attempting to lower the friction for developers to migrate from legacy relational or NoSQL databases to a multi-model engine.
Takeaway: Upgrade to 4.0 to leverage built-in PostgreSQL/MySQL compatibility if you are currently handling graph, vector, and relational data in separate systems.
Deep dive
  • Query Engine: Rebuilt from 3.x to improve throughput and concurrency.
  • Wire Protocols: Adds direct compatibility for PostgreSQL, MySQL, and MongoDB drivers.
  • Scalability: SurrealDB Earth offers serverless scaling on Cloudflare Workers; SurrealDS provides multi-zone distributed clusters.
  • Vector Search: HNSW index building is 7.4x faster; filtered vector search latency dropped from 27ms to 1.1ms.
  • Data Models: Combines relational, document, graph, vector, and time-series data under one query language, SurrealQL.
Decoder
  • Wire Protocol: The specific network communication format used by a database client to talk to the server; supporting it allows existing drivers (like those for Postgres) to connect to SurrealDB directly.
Original article

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.

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.

SurrealDB 4

Indexed queries are projected at 22x faster than in 3.x. Full-table scans are 2.3x faster, and creates, reads, updates and deletes 42% faster, as measured with crud-bench on the same hardware.

SurrealDB Earth

The SurrealDB 4 engine, serverless on Cloudflare, with thousands of isolated instances. Earth handles 10+ billion peak rows per second, fully transactional.

SurrealDS

The SurrealDB 4 engine on distributed storage over object storage, in SurrealDB Cloud multi-node clusters and Enterprise Edition. With the default two-zone policy, writes are acknowledged only after being stored on disks in both zones.

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.

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.

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();

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.

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.

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

Can my Postgres or MySQL clients connect? 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.

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

As a startup, we didn't want to fragment our stack every time we add a capability… instead we got graph, vector, and full-text from one engine. What surprised us was how quickly we stood up a multi-layered, graph-based memory model for our AI agent.

— Daniel Alker, Senior Cloud Platform Engineer, Cobrainer

An assertion edge carries the voice that made it, the document and page it came from, the figure it states and the dates it holds for. SurrealDB stores that as one record and queries it in one statement. We did not write middleware to hold the ontology together, because there is nothing to hold together.

— Jon Aiken, Chief Architect, Pivot AI

Explore all 58 articles in today's digest

Fresh dev news, AI-digested daily. Never miss a trend at devoured.fyi