cost
dbt-forge cost connects to your data warehouse and estimates the cost of running
each dbt model. Use it to find expensive queries and get materialization suggestions
that reduce warehouse spend.
Command
Section titled “Command”dbt-forge cost [--days N] [--top N] [--report] [--target TARGET]What it does
Section titled “What it does”The command reads connection credentials from profiles.yml, queries warehouse
usage metadata, and shows:
- Top N most expensive models ranked by estimated cost
- Total estimated cost across all models
- Materialization suggestions (e.g., switch a hot view to a table)
Options
Section titled “Options”--days
Section titled “--days”Number of days of usage history to analyze. Defaults to 30.
dbt-forge cost --days 7Number of top models to display. Defaults to 10.
dbt-forge cost --top 20--report
Section titled “--report”Output a markdown report instead of the Rich table. Useful for sharing or saving.
dbt-forge cost --reportdbt-forge cost --report > cost-report.md--target
Section titled “--target”dbt profile target to use for the warehouse connection. Defaults to dev.
dbt-forge cost --target prodSupported warehouses
Section titled “Supported warehouses”| Warehouse | Data source | Cost metric |
|---|---|---|
| BigQuery | INFORMATION_SCHEMA.JOBS | Bytes billed |
| Snowflake | SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY | Credits used |
| Databricks | system.billing.usage | DBUs consumed |
Other adapters (PostgreSQL, DuckDB, Redshift, Trino, Spark) are not yet supported for cost estimation. The command will show a message and exit.
Materialization suggestions
Section titled “Materialization suggestions”The command analyzes query patterns and suggests materialization changes:
| Current | Condition | Suggested | Reason |
|---|---|---|---|
view | Queried 50+ times | table | High query count indicates the view is recomputed frequently |
table | Scans 10+ GB | incremental | Large full-table rebuilds can be replaced with incremental loads |
table | Queried fewer than 3 times | view | Rarely queried tables waste storage and rebuild time |
Output
Section titled “Output”Table view (default)
Section titled “Table view (default)” dbt-forge cost (last 30 days) Model Bytes Scanned Exec Count Est. Cost Materialization fct_orders 12.4 GB 45 $3.20 table stg_payments 8.1 GB 120 $2.10 view rpt_revenue 5.3 GB 30 $1.40 table
Total estimated cost: $6.70
Materialization suggestions: stg_payments: view → table (queried 120 times)Behavior and limits
Section titled “Behavior and limits”- Must run from inside an existing dbt project (walks up to find
dbt_project.yml). - Reads connection credentials from
profiles.ymlusing theintrospectmodule. - Requires appropriate warehouse permissions to query usage metadata tables.
- Cost estimates are approximations based on usage data, not exact billing figures.
- BigQuery cost is estimated at $5/TB scanned (on-demand pricing).
- The command does not modify any warehouse data or dbt project files.