NEW

SurrealDB 4 is here, introducing SurrealDB Earth and SurrealDS!

Learn more

SurrealDB vs.
Postgres

PostgreSQL. Relational at its core, with extensions for JSON, full-text and vectors, and no native graph model.
SurrealDB. Relational, graph, vector, document and temporal data natively, with edges traversed without joins.
Speaks Postgres. SurrealDB 4 talks the Postgres wire protocol, so psql, Postgres drivers and ORMs connect as they are.

01 |THE DIFFERENCE

Where Postgres reaches, SurrealDB runs natively

Postgres covers much of this through extensions and joins. SurrealDB carries every model in the core, in one transaction.

02 |THE SAME QUERY

Similar documents, from one team, this quarter. Three joins and an operator in Postgres with pgvector. One statement in SurrealQL.

Postgres + pgvector

1-- pgvector: the similarity, then three joins
2SELECT d.title,
3 1 - (d.embedding <=> $1) AS score
4FROM document d
5JOIN authored a ON a.document_id = d.id
6JOIN person p ON p.id = a.person_id
7JOIN membership m ON m.person_id = p.id
8WHERE m.team_id = $2
9 AND d.published > now() - interval '90 days'
10ORDER BY d.embedding <=> $1
11LIMIT 10;

SurrealQL

1-- SurrealQL: the similarity and the path, together
2SELECT
3 title,
4 vector::similarity::cosine(embedding, $q) AS score
5FROM document
6WHERE embedding <|10|> $q
7 AND <-authored<-person->member_of->team CONTAINS $team
8 AND published > time::now() - 90d
9ORDER BY score DESC;

03 |HOW IT COMPARES

SurrealDB vs. Postgres + pgvector

AI and retrieval workloads stretch a relational engine past its design. SurrealDB handles them natively.

Data and relationships

SurrealDB

PostgreSQL

Models
NativeNative multi-model: document, relational, graph, key-value, time-series, vector, full-text search, and geospatial.
Via extensionsRelational database with JSON, full-text search, and vector support via extensions. No native graph model.
Relationship querying
TraversalFirst-class relationships traversed directly without joins. No join planning or join indexes required.
JoinsRelationships expressed through foreign keys and joins. Cost increases with join depth.
Operations
Architecture
DistributedDistributed, multi-model database with a decoupled query and storage layer. Efficient as single node or distributed.
MonolithicMonolithic relational engine. Extensions bolt additional capabilities onto a core not designed for multi-model execution.
Scale
HorizontalHorizontally scalable for both reads and writes. Designed to eliminate the need for sharding.
ShardedScaling beyond a single node requires manual primary/replica coordination. Large deployments commonly require manual sharding.
Schema evolution
FlexibleSchema-flexible by design. Start schemaless and incrementally enforce schema without downtime.
MigrationsSchema changes on large tables are disruptive and risky. Migrations often require maintenance windows.
Cost
Pricing
UsageOne engine in place of several specialised systems. On SurrealDB Earth a database scales to zero when idle, so you pay for the data it stores.
InfrastructureInfrastructure costs grow with index count, replicas, and sharding.

TRUSTED BY

Enterprise teams building on SurrealDB

Postgres,answered

Yes. SurrealDB 4 speaks the Postgres wire protocol for a defined subset of SQL, so psql, Postgres drivers and ORMs such as Prisma, Drizzle and TypeORM connect without a new client, and most queries run unchanged. Some column types carry caveats, and defining a schema through an ORM is more limited for now.

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

Keep your Postgres client. Add graphs, vectors and memory in one query, on SurrealDB 4.