Join

Relations that route — joins, FK placement, salting

/ Relational, / Routing, / Join, / Capacity

Relations that route — joins, FK placement, salting #

A fact collection can now behave like one. Declare the relationship in the schema and the engine takes over:

"org_id": {
  "type": "keyword",
  "immutable": true,
  "references": {"collection": "orgs"},
  "routing": true,
  "ref": true
}
  • Join queries are live — a semi-join over the wire: the inner query runs on the referenced collection, its matching keys become a membership filter on the outer side, and joins through a declared references field resolve without a second fan-out.
  • Writes place by the foreign key’s value — hash(org_id) picks the home partition, not the document key, so an org’s facts colocate. Key-addressed operations take ?routing=<value> ( fetch, update, delete).
  • Salting splits the hot org — when one routing value dominates, the _salting API spreads its writes across a partition SET (deterministic per key, round-robin for auto-IDs), with a terms feed that flags candidates against your threshold. Assignments are never auto-applied and searches stay oblivious — salting changes placement, never visibility.

One declaration, three consequences:

...

Join query

/ Join, / Query

Join query #

Status: functional (semi-join). Joins need a running node — the gateway orchestrates and the engine executes, which is why the wasm playground does not host them. The joins tutorial walks the complete relational sequence — references → join → FK-routed writes → salting → ?routing= addressing — step by step against a live node.

Matches documents in the outer collection — the one in the request URL — whose field values intersect the join_on values of documents matching a query on the inner collection — the one named by target. The result is a semi-join: outer documents that have at least one matching inner document, each reported once. It is the moral equivalent of SQL’s

...

Lesson 8 — Joins

/ Tutorial, / Join, / Relational

Lesson 8 — Joins #

Traversal (Lesson 5) walks edges inside ONE collection. A join spans TWO: it answers questions a single collection cannot — orders whose customer is gold-tier, where the tier lives in a different collection.

Joins need a running node (the gateway orchestrates the two sides, which is why the wasm playground does not host them), so this lesson is curl against your Lesson 1 node — no live widget. Like traverse, join stays DSL-side outside the SQL M1 subset.

...