SURREALQL
One query, every model. Filters, a graph walk and hybrid ranking in one statement, on one snapshot.
Hybrid query in one statement
One statement: tenant and time filters, a graph walk, and hybrid vector and full-text ranking. One transaction, one snapshot.
Try SurrealQL in StudioSELECT id, title,
vector::distance::knn() AS vec_dist,
search::score(1) AS ft_score,
(1 - vector::distance::knn()) * 0.6
+ search::score(1) * 0.4
AS blend_score
FROM knowledge_base
WHERE tenant = $tenant
AND updated_at > time::now() - 30d
AND id IN $customer->owns->product
->has_issue->knowledge_base
AND content_embedding <|50,20|>
$query_embedding
AND content @1@ $query_text
ORDER BY blend_score DESC
LIMIT 10;
Indexes built for each model
HNSW for vectors, BM25 for full-text, B-trees for lookups and the key layout itself for graph traversal. Execution streams, so a traversal feeds a vector ranking with nothing materialised between them.
-- HNSW graph for vector similarity
DEFINE INDEX product_vec ON product
FIELDS embedding
HNSW DIMENSION 1536 DIST COSINE;
-- BM25 inverted index for full-text
DEFINE INDEX article_ft ON article
FIELDS content
FULLTEXT ANALYZER english BM25;
-- B-tree for structured lookups
DEFINE INDEX user_email ON user
FIELDS email UNIQUE;
-- A traversal feeds a vector ranking
-- as one stream
SELECT id, name,
vector::distance::knn() AS dist
FROM customer:acme->owns->product
WHERE embedding <|10|> $query_vec
ORDER BY dist
LIMIT 5;
Relationships are records
An edge is a full document with its own fields and permissions. Arrow syntax walks it in either direction, filtering as it goes.
-- An edge with its own fields
RELATE customer:acme->owns->product:p42
SET since = time::now(),
seat_count = 120;
-- Walk it, filtering the edge
SELECT ->owns[WHERE seat_count > 50]->product.name
FROM customer:acme;
-- Two hops, bounded depth
SELECT ->owns->product->has_issue->knowledge_base
FROM customer:acme;
A result set that keeps arriving
Add LIVE to a SELECT and every matching change streams to the client as it commits. DIFF sends only the change; KILL ends the stream.
-- The query you already wrote, as a stream
LIVE SELECT * FROM knowledge_base
WHERE tenant = $tenant;
-- Only the change, not the whole record
LIVE SELECT DIFF FROM task
WHERE status != "closed";
-- The client receives each commit:
-- { action: "UPDATE", result: { id: task:9f2, ... } }
-- Stop receiving updates
KILL $live_id;
DATA MODELS
Composable by design. Every model is a native primitive, and any statement can combine them: a graph walk scoped by a full-text match, ranked by vector distance and streamed live.
Documents
Schemaless or schemafull records. Record links replace foreign-key joins with references the engine resolves at query time.
Graphs
Edges made with RELATE and walked with arrow syntax. Every edge is a full document with its own fields and permissions.
Vectors
HNSW indexes queried with distance functions. A structured filter narrows the candidates before the search runs.
Time-series
Native duration arithmetic, temporal aggregation and point-in-time VERSION reads without blocking writers, on a versioned storage engine (experimental).
Full-text search
BM25-scored indexes with configurable analysers and the @@ match operator, composed with every other model.
Live queries
LIVE SELECT streams changes over WebSockets. DEFINE EVENT runs logic on writes. Changefeeds keep an ordered log per table.
CAPABILITIES
Beyond the core models. Geospatial, WebAssembly extensions, custom endpoints and a single binary that runs anywhere.
Geospatial
Native GeoJSON types with distance, bearing, area and containment functions, composed with the graph in one statement.
Extensions
WebAssembly modules written in Rust, loaded into a running database and callable from SurrealQL inside the transaction.
DEFINE API
HTTP endpoints defined inside the database, with its transactions, permissions and every model behind them.
Single binary
The same engine in the browser as WebAssembly, embedded at the edge, as a server or as a cluster on object storage.
Your questions,answered
It is one engine, so the models share a key-value substrate, a query planner and a transaction coordinator. Adding a graph traversal to a vector query costs one more step, in the same plan, against the same snapshot. A single-model database wins its own discipline in isolation. Production queries are rarely in isolation: they scope, traverse, rank and commit at once, and the round trips between separate systems cost more than the per-model difference saves.
THE PLATFORM
Everything an application and its agents know. Five surfaces, one engine.
Database
Document, graph, vector, time-series and relational in one engine.

Agent Memory
What an agent learns, with its source and its time, in the same engine.

Cloud
Dedicated clusters by region, or serverless on SurrealDB Earth.

Studio
Query, explore and design the schema from the browser.

MCP
Every model that speaks MCP reaches the database and the memory directly.

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.
VP of Engineering, Later
GET STARTED