Skip to main content

Dynamic Table

Introduced or updated: v1.2.945

A dynamic table stores the result of a query in Fuse storage. The query can join multiple source tables and aggregate their data. Creation populates the table. Later changes to source tables become visible only after an explicit full refresh.

note

Dynamic tables support manual full refresh. Run REFRESH DYNAMIC TABLE to update the stored result after source data changes. For periodic refresh, issue this command from your application or an external scheduler. Between refreshes, queries return the last stored result.

Commands​

CommandDescription
CREATE DYNAMIC TABLEDefines a dynamic table and populates its initial result.
REFRESH DYNAMIC TABLERebuilds the complete stored result from the source tables.
SHOW CREATE TABLEShows the re-executable CREATE DYNAMIC TABLE statement.
DESCRIBEShows the output columns.
DROP TABLERemoves a dynamic table.

Query a dynamic table by name with SELECT. Use SHOW TABLES to list tables. In system.tables, its table_type is DYNAMIC TABLE.

Choose a derived object​

ObjectData returned by a queryMaintenance
ViewEvaluates the stored query against its sources.No stored result to refresh.
Materialized viewReturns current results with read-time correction for unrefreshed source changes.Supports incremental refresh for append-only changes on one source table.
Dynamic tableReturns the result stored by creation or the last successful refresh, even if sources have changed.Requires an explicit full refresh. Supports joins across source tables.

The optimizer does not substitute a dynamic table for a query against its sources. Reference the dynamic table directly.

For a complete example, see Dynamic Tables.

Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today