---
title: Set up a warehouse for scheduled detections
description: Scheduled detection rules run on a SQL warehouse that you provide. This page recommends how to size and configure that warehouse for detection workloads.
canonical_url: https://docs.databricks.com/aws/en/lakewatch/admin/detection-warehouse
---

# Set up a warehouse for scheduled detections

> [!NOTE]
> **Beta**
>
> Lakewatch is in [Beta](https://docs.databricks.com/aws/en/release-notes/release-types.md). Workspace admins can control access to this feature from the **Previews** page. See [ Manage workspace-level previews](https://docs.databricks.com/aws/en/admin/workspace-settings/manage-previews.md#workspace).

[Scheduled detection rules](https://docs.databricks.com/aws/en/lakewatch/detections/scheduled-detection-rules.md#how-detection-rules-run) run on a SQL warehouse that you provide. Lakewatch doesn't create or manage this warehouse. Instead, you create it in your workspace and select it when you create a scheduled detection rule. Creating and sizing a warehouse usually requires workspace administrator permissions, so this is typically an administrator setup task.

This page recommends a starting configuration for a detection warehouse. Scheduled detection rules in a workspace can share a single warehouse.

Streaming rules use compute managed by Lakewatch and don't require a SQL warehouse. See [How streaming rules run](https://docs.databricks.com/aws/en/lakewatch/detections/streaming-detection-rules.md#how-streaming-rules-run).

## <a id="prerequisites" />Prerequisites

A detection warehouse must run Databricks SQL 2026.36 and above. Lakewatch checks the version the warehouse is running, not its channel setting. If Databricks has pinned your warehouse to a specific Databricks SQL version, the pinned version must also meet this minimum.

To check the version a warehouse is running, run this query on that warehouse:

```sql
SELECT current_version().dbsql_version;
```

See [`current_version` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/current_version.md).

## <a id="unsupported-warehouse-errors" />Unsupported warehouse errors

### <a id="when-lakewatch-checks-the-version" />When Lakewatch checks the version

Lakewatch validates the warehouse version at the following points:

* **When you create a rule**: Lakewatch rejects the rule if its warehouse is unsupported.
* **When you change a rule's SQL warehouse or run-as principal**: Lakewatch rejects the change if the warehouse is unsupported.
* **When Lakewatch revalidates existing rules**: If an existing rule's warehouse is unsupported, Lakewatch stops running the rule and opens a [system error](https://docs.databricks.com/aws/en/lakewatch/system-health/system-errors.md) for it.

If Lakewatch can't determine the version a warehouse is running, it treats the warehouse as unsupported.

### <a id="use-a-supported-warehouse" />Use a supported warehouse

If Lakewatch rejects a warehouse because of its version, the error message starts with one of the following:

* `SQL warehouse '<name>' (<id>) is running a version that Lakewatch does not support.`
* `Lakewatch could not verify that SQL warehouse '<name>' (<id>) is supported.`

To recover, complete the following steps:

1. Select a SQL warehouse that meets the [minimum version](https://docs.databricks.com/aws/en/lakewatch/admin/detection-warehouse.md#prerequisites), or contact Databricks Support for help updating the warehouse.
2. Retry the rule creation or update.

If you switch an existing rule to a different supported warehouse, Lakewatch revalidates the rule right away. If the rule's current warehouse is updated to a supported version instead, Lakewatch resumes running the rule the next time it revalidates.

A different error means that Lakewatch couldn't run the version check at all:

`Lakewatch could not validate the SQL warehouse runtime. Check warehouse availability and the rule's run-as permissions, then retry.`

In this case, check that the warehouse is available and that the rule's run-as principal can use it, then retry.

## <a id="recommended-configuration" />Recommended configuration

For most workspaces, start with one serverless SQL warehouse shared by your scheduled detection rules:

| Setting        | Recommended value                                                |
| -------------- | ---------------------------------------------------------------- |
| Type           | Serverless                                                       |
| Size           | 2X-Small                                                         |
| Clusters (min) | 1                                                                |
| Clusters (max) | `ceil(peak concurrent rules / 10)`, up to the 40-cluster maximum |
| Auto stop      | 10 minutes                                                       |

A 2X-Small warehouse can run 100 or more simple detections. Because a SQL warehouse is billed by cluster uptime rather than per query, the more rules that share a warehouse, the lower the cost per rule.

> [!NOTE]
>
> A warehouse that runs only one or two rules has a high cost per rule, because you pay for the warehouse's uptime even when few rules use it. To lower the cost per rule, share one warehouse across many detections.

## When to adjust

Use the following guidance to adjust the defaults for your workload:

* **Many, high, or bursty rules**: Raise the maximum cluster count so queries don't queue. Adding clusters (scaling out) is the main lever for concurrency. Each cluster has roughly 10 query slots.
* **Latency-critical detections**: Set a warm floor (minimum of 2 or more clusters) or a longer auto stop to avoid cold starts, at higher cost.
* **Few, infrequent, or cost-sensitive rules**: Lower auto stop to 5 minutes (the minimum) to reduce idle time. A cold warehouse restarts in about 5 seconds.
* **Heavy or complex queries** (large scans or joins): Increase the warehouse size (Small, Medium, or larger). Use a bigger size (scaling up) only when an individual query needs more memory or compute.

## Cost attribution

To track detection cost on its own, use a dedicated warehouse for detection workloads rather than sharing one with other query activity. Because billing is per cluster uptime, a dedicated warehouse makes it straightforward to attribute cost to detection.

## Next steps

Select this warehouse when you [create a scheduled detection rule](https://docs.databricks.com/aws/en/lakewatch/detections/scheduled-detection-rules.md#create-a-scheduled-rule).
