mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-13 22:26:53 +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>
78 lines
2.9 KiB
Plaintext
78 lines
2.9 KiB
Plaintext
---
|
|
title: "Create a view"
|
|
sidebarTitle: "Create View"
|
|
description: "Define a derived dataset as a saved query, with no storage or refresh of its own."
|
|
icon: eye
|
|
keywords: ["view", "create view", "feature engineering", "saved query"]
|
|
availability:
|
|
embedded: unavailable
|
|
enterprise: available
|
|
---
|
|
|
|
A view is the lightest way to derive a feature-engineered dataset: it stores
|
|
a **query**, not rows, so there is nothing to refresh and nothing that can
|
|
fall out of date. Reach for one before
|
|
[a computed column](/feature-engineering/add-computed-column) or
|
|
[a materialized view](/feature-engineering/materialized-views) when the
|
|
underlying query is cheap enough to simply re-run on every read.
|
|
|
|
## Define a view {#create}
|
|
|
|
A view over a products table, selecting and deriving a few columns:
|
|
|
|
<CodeGroup>
|
|
```sql SQL icon="database"
|
|
CREATE VIEW "discounted_products" AS
|
|
SELECT id, name, price, price * 0.9 AS sale_price
|
|
FROM "products"
|
|
WHERE in_stock = true
|
|
```
|
|
</CodeGroup>
|
|
|
|
The statement resolves the view's schema from the query at creation time.
|
|
Anything the [SQL dialect](/sql/dql/functions) supports can define one: joins,
|
|
predicates, aggregates, window functions -- the same expressiveness as
|
|
[a computed column's](/feature-engineering/add-computed-column#expressions)
|
|
SQL expression, just over a whole derived table instead of one column.
|
|
|
|
## Read it like a table {#reading}
|
|
|
|
<CodeGroup>
|
|
```sql SQL icon="database"
|
|
SELECT * FROM "discounted_products" WHERE sale_price < 20
|
|
```
|
|
</CodeGroup>
|
|
|
|
Every read runs the saved query against current data, so `sale_price`
|
|
reflects whatever `price` is right now -- there is no staleness window to
|
|
reason about, unlike a materialized view between refreshes. A predicate
|
|
applied when reading the view composes with the query inside it, rather than
|
|
filtering the view's output afterward, so a selective filter does not pay
|
|
for rows the view would have produced and then discarded.
|
|
|
|
## When to use a view instead {#choosing}
|
|
|
|
| | View | Computed column / materialized view |
|
|
| --- | --- | --- |
|
|
| Stores | the query | derived values |
|
|
| Freshness | always current | as of the last refresh |
|
|
| Read cost | the full query, every read | a column or table scan |
|
|
| Write cost | none | a refresh |
|
|
|
|
Reach for a view when the query is cheap, or when reading a stale value would
|
|
be wrong for the workload. Reach for a computed column or a materialized view
|
|
when the query is expensive and the data changes less often than it is read.
|
|
See [View](/sql/ddl/view#choosing) for the full SQL reference comparison,
|
|
including the separate privileges each one needs.
|
|
|
|
## What to read next {#next}
|
|
|
|
<CardGroup cols={2}>
|
|
<Card title="View" icon="eye" href="/sql/ddl/view">
|
|
CREATE VIEW, DROP VIEW, and listing views alongside tables.
|
|
</Card>
|
|
<Card title="Create a materialized view" icon="table" href="/feature-engineering/materialized-views">
|
|
The stored-rows counterpart, and when a refresh is worth paying for.
|
|
</Card>
|
|
</CardGroup>
|