外观
本页尚未翻译
本页内容仍为英文原文,源自官方文档 sql/ddl/materialized-view。中文翻译正在分批进行中。
Materialized View
CREATE MATERIALIZED VIEW and SHOW MATERIALIZED VIEWS; refreshing is a REFRESH statement.
Applies to: Embedded ❌, Enterprise ✅
A materialized view stores a query's result as rows, kept current by a refresh. It is the counterpart to a view, which stores only the query.
说明
Materialized views are off by default in LanceDB Enterprise and have to be enabled there. Which statements and query shapes a deployment accepts, whether it needs the source table to have stable row ids, and how it refreshes a view depend on its LanceDB Enterprise version and configuration.
CREATE MATERIALIZED VIEW
sql
CREATE MATERIALIZED VIEW <name> AS SELECT ...Once created, a materialized view can be queried like a table. Use the statements below to list, refresh and drop it. For SDK methods, see Materialized views.
SHOW MATERIALIZED VIEWS
sql
SHOW MATERIALIZED VIEWS说明
This asks the server for its views, as the SDK's list_materialized_views does on a db:// connection.
Refreshing one
sql
REFRESH MATERIALIZED VIEW chunksSee REFRESH MATERIALIZED VIEW for the full syntax, and compatibility notes for older server versions.
Dropping one
sql
DROP MATERIALIZED VIEW <name>A dedicated statement; the SDKs emit it rather than DROP TABLE, even though a materialized view is a table underneath. For the same reason, dropping one removes stored rows, unlike dropping a view.
说明
Enterprise job type for a refresh: sql. Dropping, by contrast, runs the same underlying job as dropping any table, drop_table or drop_object.