Purpose
DBU Waste Finder is used to analyze DBU consumption in a Databricks workspace, identify resources that appear to be wasted, and provide actionable remediation recommendations. It only reads Databricks system tables and does not modify any resources.
Main components
The repository contains two parts:
notebook/: a free Notebook that can be imported into a workspace and run without installation, and does not send data outside the workspace.mcp/: an MCP server that enables AI clients such as Claude and Cursor to answer "why did our bill jump" based on system tables and to propose remediation recommendations to an Asset Bundle as a diff; this process is read-only, and recommendations are never applied automatically.
Usage
- Import
notebook/dbu_waste_finder.pyinto a workspace (File → Import). - Attach to any compute resource (serverless is also fine); the running user needs USE CATALOG on
system, and USE SCHEMA + SELECT privileges onsystem.billing、system.compute、system.lakeflow、system.query. - Adjust the thresholds in the first cell, then Run all. Checks for schemas that are not enabled are skipped.
The MCP server runs on your local machine, uses your token to read system tables, and returns results to the AI client.
Projections and confidence
measured_saving_usd/measured_waste_dbu: waste found by checks within the analysis window (USD counts only items with pricing).observation_days: the number of days of data actually covered by the window, from the earliest record within the lookback window to the current time, capped at the lookback days.projected_30d_usd/projected_30d_dbu: extrapolated as "measured ÷ observed days × 30" only whenobservation_days≥ 3; null when fewer than 3 days or unknown, with the reason stated.low_confidence: true with a note when observed days < 7; projections are shown but flagged for 3–7 days; not flagged at exactly 7 days.
This projection is an extrapolation of past waste at list price and does not guarantee actual savings.
Use cases
- Check for waste such as idle or oversized clusters, warehouses with long auto-stop times, and serverless jobs.
- Quickly query cost summaries, main cost drivers, and waste items through an AI client.
- Generate remediation recommendation diffs in an Asset Bundle for human review.
Limitations and notes
- Costs use
pricing.effective_list.default(list price), not contracted discounted prices. - Idle/oversized clusters are counted as 50% of cost as waste (adjustable via
IDLE_SAVING_SHARE), and checks may overlap. - DBU/hour for idle warehouses is assumed based on Databricks SQL published rates.
system.billing.usagehas a delay of several hours;system.computeandsystem.queryare usually available earlier.usage_metadata.job_idis not populated for jobs on all-purpose compute and must be detected viajob_task_run_timeline.compute_ids.system.billingis account-level, butsystem.computeandsystem.lakeflowcover only workspaces in the current region; cross-region cluster usage is listed incluster_region_gapand warns that it must be run separately by region.- If a SKU has no record in
system.billing.list_prices, the USD total only aggregates the priced portion, marksusd_complete = false, and lists the unpriced SKUs; DBU is always displayed. - The MCP server returns job/cluster/warehouse names and IDs, DBU, list price amounts, and owner email addresses to the AI client and its provider; it is recommended to use a read-only service principal and to connect only AI clients that can share this metadata.
- Not affiliated with Databricks; MIT licensed.
Verification status
Actually run on a Databricks trial workspace (AWS, serverless only): all queries are executable; the idle warehouse check, the warehouse long auto-stop check, and the cost tools all return results. Classic cluster-related checks (all-purpose jobs, auto-termination, idle clusters) have not yet been verified in a real environment because the trial workspace cannot run classic clusters.