Pular para o conteúdo principal

ANALYZE TABLE … DROP STATISTICS

Applies to: check marked yes Databricks SQL check marked yes 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.

Syntax

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

Parameters

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;