mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-13 15:22:30 +00:00
Databases, namespaces, jobs and data evolution work in both offerings. Materialized views, computed columns and column refresh work in the embedded library and vary on a deployment, which has to enable them. Views and functions exist only on a deployment that enables them, and aggregation, joins, windowing and sampling are SQL, so they need one with SQL enabled. Sections now say where they differ: views have SDK methods on a deployment, dropping a function needs a further setting, a local job handle runs in-process and has no history, create_index and refresh_column behave differently against a deployment, and the overviews no longer call computed columns and materialized views available everywhere.
35 lines
1.3 KiB
Plaintext
35 lines
1.3 KiB
Plaintext
---
|
|
title: "Views"
|
|
sidebarTitle: "View"
|
|
description: "A saved query, evaluated when read. The non-materialized counterpart to a materialized view."
|
|
icon: eye
|
|
keywords: ["view", "create view", "sql", "catalog"]
|
|
availability:
|
|
oss: unavailable
|
|
enterprise: varies
|
|
summary: >-
|
|
Views need a LanceDB Enterprise deployment that has them enabled; the
|
|
embedded library cannot create them.
|
|
---
|
|
|
|
A view stores a **query**, not rows. Reading it runs the query against current
|
|
data, so a view is never stale -- and never faster than the query it wraps.
|
|
|
|
It is the counterpart to a
|
|
[materialized view](/management/materialized-view), which stores rows and is
|
|
brought up to date by a refresh. Both are [catalog objects](/basics/catalog)
|
|
defined by a query; the difference is entirely when that query runs.
|
|
|
|
| | View | Materialized view |
|
|
| --- | --- | --- |
|
|
| Stores | the query | the rows |
|
|
| Freshness | always current | as of the last refresh |
|
|
| Read cost | the full query, every read | a table scan |
|
|
| Write cost | none | a refresh |
|
|
|
|
Views are created on a deployment, either in SQL over the
|
|
[Flight SQL endpoint](/sql#connecting) or with the SDKs' `create_view` /
|
|
`createView`, which send the query to the deployment. Either way, the deployment
|
|
must have views enabled. See [View](/sql/ddl/view) for `CREATE VIEW`,
|
|
`DROP VIEW`, and listing.
|