mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-13 14:16:54 +00:00
A broad documentation pass across the areas LanceDB Enterprise and Embedded diverge on most: **Data Curation** -- GPU Function execution, Slurm scheduling (and what Slurm is, for readers new to it), blob late materialization as its own page, joins, aggregation/profiling, sampling, near-duplicate detection, chunking, distributed shuffle, and IVF-partition clustering. **Feature Engineering** -- computed columns and materialized views, restructured to lead with the Function-based path and show the SQL form side by side with Python throughout; a single Auto Refresh page instead of duplicating scheduling details on every refresh page; adaptive execution; checkpointing; GPU and Slurm placement for refresh workers; a Training Cache page for the PyTorch data loader's automatic cache benefit. **Security & Governance** -- an Audit Log reference (schema, access, grants), Secrets promoted to an ordinary catalog object with their own SQL DDL and a vending/rotation guide, and privilege-table fixes verified against the authorization source. **Deployment & Maintenance** -- Horizontal Scaling and OpenTelemetry moved into a real Deployment area; Automated Cleanup folded into Intelligent Auto-Maintenance (every other maintenance decision already lived there); RTE Compaction and Advanced Conflict Resolution documented in depth. **Landing page** -- the Enterprise feature comparison table reorganized (several redundant or stale rows removed, several new areas added), and the "why Enterprise" bullets replaced with ones tied to a concrete page (Performance, Scale, Fault tolerance, Multicloud deployment, Simplify operations) instead of vague promises. Plus a full pass addressing lancedb-gatekeeper's review: a real test-safety bug (a quickstart test could silently overwrite and delete a deployment's own `frames` table), a fabricated SQL statement with no backing implementation, an actual dedup-guarantee bug in `take_row_ids`, and dozens of documentation-accuracy fixes verified against source rather than taken on faith -- each either fixed, or left with an explicit note on why it needs a feature or deployment owner's sign-off instead of being guessed at. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018PXMCbRH6i5w47TsjeEUMT --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
93 lines
3.0 KiB
Plaintext
93 lines
3.0 KiB
Plaintext
---
|
|
title: "Joins"
|
|
sidebarTitle: "Joins"
|
|
description: "Combining rows from more than one table, including across namespaces."
|
|
icon: link
|
|
keywords: ["join", "inner", "left", "outer", "cross", "namespace"]
|
|
availability:
|
|
embedded: unavailable
|
|
enterprise: available
|
|
---
|
|
|
|
Use SQL joins to combine rows from two or more tables.
|
|
|
|
## The join types {#types}
|
|
|
|
<CodeGroup>
|
|
```sql SQL icon="database"
|
|
SELECT d.title, c.name
|
|
FROM documents AS d
|
|
JOIN categories AS c ON c.id = d.category_id
|
|
```
|
|
</CodeGroup>
|
|
|
|
| | What it keeps |
|
|
| --- | --- |
|
|
| `[INNER] JOIN` | rows matching on both sides |
|
|
| `LEFT [OUTER] JOIN` | every left row, nulls where the right has no match |
|
|
| `RIGHT [OUTER] JOIN` | every right row |
|
|
| `FULL [OUTER] JOIN` | every row from both |
|
|
| `CROSS JOIN` | every combination (the product of the two) |
|
|
|
|
`USING (col)` is shorthand for an equality join on a shared column name, and
|
|
avoids repeating it in the select list.
|
|
|
|
## Across namespaces {#namespaces}
|
|
|
|
Tables in different [namespaces](/management/namespace) join like any other table, each
|
|
addressed by its full `database.schema.table` identifier. The catalog is one
|
|
catalog, so there is nothing to federate:
|
|
|
|
<CodeGroup>
|
|
```sql SQL icon="database"
|
|
SELECT c.id, u.email
|
|
FROM prod.events.clicks AS c
|
|
JOIN prod.reference.users AS u ON u.id = c.user_id
|
|
```
|
|
</CodeGroup>
|
|
|
|
## Joining a search result {#search}
|
|
|
|
[`fts()`](/sql/dql/fts) is a table function, so its result is a relation
|
|
and joins like any other. This example assumes `my_docs` has `text` and
|
|
`category_id` columns, a full-text index on `text`, and a `categories` table
|
|
with `id` and `name` columns:
|
|
|
|
<CodeGroup>
|
|
```sql SQL icon="database"
|
|
SELECT c.name, count(*) AS hits
|
|
FROM fts(
|
|
'my_docs',
|
|
'{"match":{"column":"text","terms":"puppy"}}'
|
|
) AS m
|
|
JOIN categories AS c ON c.id = m.category_id
|
|
GROUP BY c.name
|
|
ORDER BY hits DESC
|
|
```
|
|
</CodeGroup>
|
|
|
|
That composition is the reason full-text search is a relation rather than a
|
|
predicate: a `WHERE` clause has nowhere to put the relevance score.
|
|
|
|
## Performance {#performance}
|
|
|
|
A [scalar index](/indexing/scalar-index) can accelerate supported filters on
|
|
the input tables. An index on a join key does not by itself guarantee an
|
|
index lookup join. Use SQL [`EXPLAIN`](/sql/dql/explain) to inspect the scans,
|
|
filters, and join chosen for the complete statement.
|
|
|
|
<Warning>
|
|
Avoid selecting blob or vector columns you do not need on either side of a join.
|
|
The join multiplies rows before projection is applied in some plans, so a wide
|
|
column can be materialized many more times than the result has rows.
|
|
</Warning>
|
|
|
|
## Late materialization for wide columns {#late-materialization}
|
|
|
|
The planner can avoid the multiplication above: when a join narrows down to
|
|
a key column before a wide one is needed, it can defer reading a BlobV2 or
|
|
vector column until after the join has already settled which rows survive.
|
|
See [Blob Late Materialization](/curation/blob-late-materialization) for
|
|
the eligibility conditions, the `RemoteTake` operator, and how to confirm
|
|
a specific query got the deferred read with [`EXPLAIN`](/sql/dql/explain).
|