# Idle Azure SQL Database

> Idle detection for Azure SQL databases requires DTU utilization below 5% over 30 days plus a present SQLConnectionSuccessful series showing no connections. Serverless databases get auto-pause savings from the measured idle fraction; provisioned tiers get a one-tier DTU step-down priced from real rate deltas, abstaining when neither quantifies.

Source: https://zop.dev/integrations/azure/recommendations/idle-azure-sql-database
Updated: 2026-08-19

---

## Low DTU plus no successful connections

- MetricsAware: DTUPercentage over 30 days (low-DTU gate) and SQLConnectionSuccessful (required; absent => abstain; >0 => in use, skip)
- ScheduleAware (SetScheduleData): measured idle fraction for the serverless auto-pause branch
- SKURatesAware (SetSKURates) + TargetSKUCandidates: source/target DTU-tier rates for the non-serverless step-down branch

## The DTU floor and lookback window

```text
azureDTUThreshold=5.0, azureDTULookbackDays=30
```

## Auto-pause or a one tier DTU step down

branched on compute tier; no flat fraction.
- Serverless-vCore → enable/shorten auto-pause. Auto-pause stops the compute charge only (storage keeps billing). Saving = cost × sd.IdlePercentage (real measured idle fraction from SetScheduleData); absent/zero idle data => abstain.
- Non-serverless (DTU model / provisioned vCore) → one-tier DTU step-down (rightsize). Pause is impossible; priced from the real source→target DTU-tier rate delta via DeriveCatalogDiffSavings(src, dst, cost, 0) (mirrors sibling RC-230, lever suggestSmallerSQLDTU). No smaller rung resolves, or either DTU-tier rate missing/inverted/out-of-band => saving 0 => abstain (no 30% estimate under the cost-driven idle category). Abstains on pricing absent (cost ≤ 0). EvalContextRule: a DB with a known active schedule is suppressed (intentionally parked off-hours, not abandoned).

## Pausing, scaling down, or dropping the database

1. Check Azure Monitor metrics for DTU/CPU usage
2. Verify no applications are connecting
3. Serverless: configure auto-pause delay (min 15 min); storage keeps billing while paused. Non-serverless: scale down one DTU tier.
4. If not needed, delete the SQL database

## DTU usage paired with a connection guard

DTUPercentage (DTU avg gate) + SQLConnectionSuccessful (required corroborating activity guard), both over azureDTULookbackDays (30d)
