Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,25 @@ This statement is used to collect statistical information for various columns.
```sql
ANALYZE < TABLE | DATABASE table_name | db_name >
[ (column_name [, ...]) ]
[ [ WITH SYNC ] [ WITH SAMPLE PERCENT | ROWS ] ];
[ WITH SYNC ]
[ WITH [ SAMPLE PERCENT | ROWS ] | [FULL] ]
[ WITH INCREMENTAL ]
[ WITH HISTOGRAM ]
[ WITH BUCKETS < bucket count > ]
[ WITH PERIOD < interval in seconds> ]
[ WITH CRON <cron expression> ];
```

- `table_name`: The specified target table. It can be in the format `db_name.table_name`.
- `column_name`: The specified target column. It must be an existing column in `table_name`. You can specify multiple column names separated by commas.
- `sync`: Collect statistics synchronously. Returns after collection. If not specified, it executes asynchronously and returns a JOB ID.
- `sample percent | rows`: Collect statistics with sampling. You can specify a sampling percentage or a number of sampling rows.
- `full`: Collect statistics with force sampling method full. You can specify either FULL or sample percent/row.
- `incremental`: Collects statistics incrementally or all at once (default: full)
- `histogram`: Collects statistics and build histogram of the specified columns.
- `buckets`: Specifies number of buckets for histogram.
- `period`: Specifies the interval time in which analyze should be scheduled.
- `cron`: Collects statistics periodically based on the cron expression.

### Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,25 @@ ANALYZE
```sql
ANALYZE < TABLE | DATABASE table_name | db_name >
[ (column_name [, ...]) ]
[ [ WITH SYNC ] [ WITH SAMPLE PERCENT | ROWS ] ];
[ WITH SYNC ]
[ WITH [ SAMPLE PERCENT | ROWS ] | [FULL] ]
[ WITH INCREMENTAL ]
[ WITH HISTOGRAM ]
[ WITH BUCKETS < bucket count > ]
[ WITH PERIOD < interval in seconds> ]
[ WITH CRON <cron expression> ];
```

- table_name: 指定的目标表。可以是  `db_name.table_name`  形式。
- column_name: 指定的目标列。必须是  `table_name`  中存在的列,多个列名称用逗号分隔。
- sync:同步收集统计信息。收集完后返回。若不指定则异步执行并返回JOB ID。
- sample percent | rows:抽样收集统计信息。可以指定抽样比例或者抽样行数。
- `table_name``: 指定的目标表。可以是  `db_name.table_name`  形式。
- `column_name`: 指定的目标列。必须是  `table_name`  中存在的列,多个列名称用逗号分隔。
- `sync`:同步收集统计信息。收集完后返回。若不指定则异步执行并返回JOB ID。
- `sample percent | rows`:抽样收集统计信息。可以指定抽样比例或者抽样行数。
- `full`:使用完整的强制采样方法收集统计数据。 您可以指定 FULL 或样本百分比/行。
- `incremental`:增量或一次性收集统计信息(默认:完整)
- `histogram`:收集统计信息并构建指定列的直方图。
- `buckets`:指定直方图的桶数。
- `period`:指定应安排分析的间隔时间。
- `cron`:根据 cron 表达式定期收集统计信息。

### Example

Expand Down