Crosshire
← Databricks
— Crosshire / Learn · Tech · Databricks

Databricks Audit

96 copy-paste SQL queries that audit a Databricks account's cost, performance, compute, jobs, serving, storage and governance — built entirely on system.* tables. No app to install, no dashboard to wire up: open a query, read what it does and how to read the result, copy the SQL, and run it.

96 queries7 domains10 first-audit picks
Start hereThe first audit — a guided runbookRun the ten highest-signal queries in order — trust check, then the money, then the risk — and walk away with a filled findings sheet in about 90 minutes. No system-tables background needed.

Everything here is open source — grab all 96 queries from the GitHub repository ↗. Clone the repo and every .sql file is ready to paste; each query below also links straight to its own source.

Who this is for

FinOps & cost owners

Find where the bill actually goes, prove the negotiated discount is landing, charge back by team, and hunt recoverable waste.

Platform & workspace admins

Right-size compute, move jobs off expensive all-purpose clusters, and shut down idle warehouses and dormant serving endpoints.

Data engineers

Tune the heaviest queries with real pruning / spill / shuffle signals, harden pipeline reliability, and keep table maintenance efficient.

Security, governance & compliance

Audit grants, masks and row filters, trace how far PII propagates, and catch run-as escalation and network exfiltration attempts.

The library, by domain

Seven domains. Pick one to browse its queries — almost every one is a copy-paste SELECT that takes a :period_days bind parameter.

★ The first audit

New to the account? These ten are the highest-signal queries to run first — the biggest money and the biggest risk.

How to run

  1. Open a Databricks SQL editor (or a notebook on a SQL warehouse / UC-enabled cluster).
  2. Make sure you have SELECT on the system.* schema the query reads — some schemas must be enabled by an account admin first.
  3. Open a query here, copy its SQL, set the look-back window on the :period_days parameter, and run.
Best-effort by design. Databricks system tables aren't uniformly available: a query may return nothing or raise TABLE_OR_VIEW_NOT_FOUND / insufficient_privileges on your account — that's expected, not a bug. Every dollar figure is est · at list (pre-discount, DBU-only) unless a query joins account_prices, and usage_quantity is DBUs / bytes / hours / tokens — never dollars. Sample-output tables are illustrative synthetic rows, never real account data.

Conventions

  • Read-only, with one exception. Every query is a plain SELECT except storage_breakdown_analyze, which runs ANALYZE TABLE … COMPUTE STORAGE METRICS — it writes table statistics (flagged in red on its page). Run it only against tables you are allowed to analyze.
  • Every dollar figure is est · at list (pre-discount, DBU-only from system.billing.list_prices) unless a query explicitly joins account_prices.
  • usage_quantity is DBUs / bytes / hours / tokens — never dollars.
  • Query output is sensitive: identities / emails are not masked by these raw queries.
  • Sample-output tables are illustrative synthetic rows, never real account data.