NEW

New University Course: SurrealDB for AI Engineers

Start the course

1/3

GRAPH AND VECTOR

Graph and vector, one query

Graph. Relationships as native edges with fields of their own, traversed with arrow syntax to any depth.
Vector. HNSW and DiskANN indexes on the same records, with Cosine, Euclidean and inner-product metrics.
One statement. Traverse, filter and rank by similarity in one query, with the merge done by the engine.

CONNECTED DATA

Relationships and similarity, together

Edges are documents you traverse with arrow syntax; vectors are an index on the same table. One query walks the graph and ranks by meaning.

GRAPH RELATIONSHIPS

Edges are records you traverse

RELATE customer:alice->purchased->product:widget_pro
SET quantity = 2, date = time::now(), source = 'web';

SELECT ->purchased[WHERE date > time::now() - 30d]->product.name
FROM customer:alice;
VECTOR SEARCH

Similarity on the same records

DEFINE INDEX product_embedding ON product
FIELDS embedding HNSW DIMENSION 1536 DIST COSINE;

SELECT id, name, vector::distance::knn() AS distance
FROM product
WHERE category = 'tools'
AND embedding <|10,40|> $query_embedding
ORDER BY distance;

Graph and vector as the same records

One query, both models

Traverse relationships and rank by similarity in one statement, with the merge done by the engine.

One copy, in step

The vectors are an index on the source records, so they are as current as the write that made them.

One pass

Filter, traverse and rank run in one engine, in one pass, in one transaction.

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

Query relationships and meaning together. Traverse the graph and rank by vector similarity in one SurrealQL query.