---
title: "analyze"
description: "Analyze is an SQL statement used in various database systems, including DuckDB, to gather statistics about tables and columns."
canonical: "https://motherduck.com/glossary/analyze/"
related:
  - title: "Why Use DuckDB for Analytics?"
    url: "https://motherduck.com/blog/six-reasons-duckdb-slaps/"
  - title: "EXPLAIN ANALYZE | MotherDuck Docs"
    url: "https://motherduck.com/docs/sql-reference/motherduck-sql-reference/explain-analyze/"
  - title: "DuckDB statements | MotherDuck Docs"
    url: "https://motherduck.com/docs/sql-reference/duckdb-sql-reference/duckdb-statements/"
---

# analyze

> Analyze is an SQL statement used in various database systems, including DuckDB, to gather statistics about tables and columns.

[Analyze](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/sql-reference/statements/analyze.md) is an SQL statement used in various database systems, including DuckDB, to gather statistics about tables and columns. These statistics help the query optimizer make better decisions when planning query execution. In DuckDB, the `ANALYZE` command updates statistics for a table or the entire database, which can lead to improved query performance. 

For example, to analyze a specific table in DuckDB:

```sql
ANALYZE mytable;
```

To analyze all tables in the current database:

```sql
ANALYZE;
```

By running `ANALYZE`, you're helping the database understand the distribution of data within your tables, which can result in more efficient query plans and faster query execution times. This is particularly useful after large data modifications or when you notice unexpected performance issues with your queries.
