---
title: ANALYZE TABLE … DROP STATISTICS
description: Learn how to use ANALYZE TABLE … DROP STATISTICS to remove optimizer statistics from Unity Catalog tables in Databricks SQL and Databricks Runtime 18.1 and above.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-aux-analyze-drop-statistics
---

# ANALYZE TABLE … DROP STATISTICS

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime 18.1 and above

The `ANALYZE TABLE … DROP STATISTICS` command removes optimizer statistics from a Unity Catalog table. Use this command to clear stale or incorrect statistics so the query optimizer no longer relies on them. To collect new statistics, see [ANALYZE TABLE … COMPUTE STATISTICS](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-aux-analyze-compute-statistics.md).

## Syntax

```
ANALYZE TABLE table_name DROP [ MANUAL | AUTO | ALL ] STATISTICS
```

## Parameters

* **[table\_name](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-names.md#table-name)**

  Identifies the table whose statistics you want to drop. The name must not include a [temporal specification or options specification](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-names.md#table-name) or path.
  If the table cannot be found Databricks raises a [TABLE\_OR\_VIEW\_NOT\_FOUND error condition](https://docs.databricks.com/aws/en/error-messages/table-or-view-not-found-error-class.md).

* **`{ MANUAL | AUTO | ALL }`**

  An optional qualifier that selects which statistics to drop. If you omit the qualifier, the command drops only manual statistics.

  | **Qualifier** | **Description**                                                                                                                                                                           |
  | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `MANUAL`      | The default. Drops statistics collected by [ANALYZE TABLE … COMPUTE STATISTICS](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-aux-analyze-compute-statistics.md). |
  | `AUTO`        | Drops statistics collected by auto-stats and [Predictive optimization for Unity Catalog managed tables](https://docs.databricks.com/aws/en/optimizations/predictive-optimization.md).     |
  | `ALL`         | Drops both manual and automatic statistics.                                                                                                                                               |

## Requirements

* The table must be registered in Unity Catalog. Running this command against a Hive metastore table raises an `AnalysisException`.
* You must have `MODIFY` privilege on the table.

## Examples

```sql
-- Drop only manual statistics. This is the default behavior.
> ANALYZE TABLE main.sales.orders DROP STATISTICS;

-- Drop only statistics collected by auto-stats or predictive optimization.
> ANALYZE TABLE main.sales.orders DROP AUTO STATISTICS;

-- Drop all statistics for the table.
> ANALYZE TABLE main.sales.orders DROP ALL STATISTICS;
```

## Related statements

* [ANALYZE TABLE … COMPUTE STATISTICS](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-aux-analyze-compute-statistics.md)
* [ANALYZE TABLE … COMPUTE STORAGE METRICS](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-aux-analyze-compute-storage-metrics.md)
* [Predictive optimization for Unity Catalog managed tables](https://docs.databricks.com/aws/en/optimizations/predictive-optimization.md)
* [Cost-based optimizer](https://docs.databricks.com/aws/en/optimizations/cbo.md)
