Table Materialization
A table materialization rebuilds your model as a physical table in your data warehouse during each dbt run. Unlike views, tables store the actual data rather than just the query logic, using aCREATE TABLE AS statement.
How Table Materializations Work
When you materialize a model as a table, dbt executes the model’s SQL query and stores the results as a table in your data warehouse. During each run, dbt:- Runs
DROP TABLE IF EXISTSon the existing table - Executes
CREATE TABLE ASwith your model’s SQL - Applies any configured table properties (like indexes, distribution keys, etc.)
- Data is physically stored in your warehouse
- Queries against the table are faster but builds take longer
- Data isn’t automatically updated when source data changes
CREATE TABLE AS statement:
Tables are ideal when query performance is more important than build time or real-time data needs.
When to Use Table Materializations
Tables are particularly valuable for:Configuring Table Materializations
Tables can be configured at both the model and project level.Model-Level Configuration
Project-Level Configuration
marts/ directory to materialize as tables.
Performance Optimization
Different warehouses offer specific optimization options for tables:
To apply these optimizations, use the
config() function with warehouse-specific parameters:
Advantages and Limitations
When to Consider Other Materializations
While tables are powerful, consider alternatives when:- Data needs to be real-time (use views)
- Table is very large and only needs incremental updates (use incremental)
- Model is a simple intermediate transformation used by only one downstream model (use ephemeral)
Best Practices
- Materialization Strategy: Use tables for final reporting layers and complex transformations
- Build Frequency: Schedule table rebuilds based on source data update frequency
- Performance Tuning: Apply appropriate indexes, partitioning, or clustering for your warehouse
- Resource Management: Schedule builds during off-peak hours for large tables
- Monitoring: Track build times and storage usage to identify optimization opportunities