diff --git a/.translation-init b/.translation-init index facc166f53..ba78d13abd 100644 --- a/.translation-init +++ b/.translation-init @@ -1 +1,2 @@ -Translation initialization: 2025-10-15T10:09:57.778195 +Translation initialization: 2025-10-15T10:33:22.601610 + diff --git a/docs/cn/sql-reference/10-sql-commands/00-ddl/01-table/80-analyze-table.md b/docs/cn/sql-reference/10-sql-commands/00-ddl/01-table/80-analyze-table.md deleted file mode 100644 index c292175926..0000000000 --- a/docs/cn/sql-reference/10-sql-commands/00-ddl/01-table/80-analyze-table.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: ANALYZE TABLE -sidebar_position: 7 ---- - -计算表的各种统计信息。此命令在执行后*不*显示结果。要显示结果,请使用函数 [FUSE_STATISTIC](../../../20-sql-functions/16-system-functions/fuse_statistic.md)。 - -Databend 将每个表的统计数据保存为一个以 UUID(32 个字符的小写十六进制字符串)命名的 JSON 文件,并将这些文件存储在对象存储中的路径 `/[root]///`。 - -## 语法 - -```sql -ANALYZE TABLE [ . ] -``` - -- 该命令不是通过比较来识别不同的值,而是通过计算存储段和块的数量。这可能会导致估计结果与实际值之间存在显着差异,例如,多个块包含相同的值。在这种情况下,Databend 建议在运行估计之前,尽可能地压缩存储段和块以合并它们。 -- 执行 update/delete/replace 语句后,快照级别的列统计信息可能会被放大。您可以通过执行 analyze 语句来更正列统计信息。 - -## 示例 - -此示例估计表中每列的不同值的数量,并使用函数 [FUSE_STATISTIC](/sql/sql-functions/system-functions/fuse_statistic) 显示结果: - -```sql -CREATE TABLE sample ( - user_id INT, - name VARCHAR(50), - age INT -); - -INSERT INTO sample (user_id, name, age) VALUES -(1, 'Alice', 30), -(2, 'Bob', 25), -(3, 'Charlie', 35), -(4, 'Diana', 28), -(5, 'Eve', 28); - -SET enable_analyze_histogram = 1; - --- 在使用 ANALYZE TABLE 运行估计之前,FUSE_STATISTIC 不会返回任何结果。 -SELECT * FROM FUSE_STATISTIC('default', 'sample'); - -ANALYZE TABLE sample; - -SELECT * FROM FUSE_STATISTIC('default', 'sample'); - -┌─────────────┬────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ column_name │ distinct_count │ histogram │ -├─────────────┼────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ -│ age │ 4 │ [bucket id: 0, min: "25", max: "25", ndv: 1.0, count: 1.0], [bucket id: 1, min: "28", max: "28", ndv: 1.0, count: 1.0], [bucket id: 2, min: "28", max: "28", ndv: 1.0, count: 1.0], [bucket id: 3, min: "30", max: "30", ndv: 1.0, count: 1.0], [bucket id: 4, min: "35", max: "35", ndv: 1.0, count: 1.0] │ -│ user_id │ 5 │ [bucket id: 0, min: "1", max: "1", ndv: 1.0, count: 1.0], [bucket id: 1, min: "2", max: "2", ndv: 1.0, count: 1.0], [bucket id: 2, min: "3", max: "3", ndv: 1.0, count: 1.0], [bucket id: 3, min: "4", max: "4", ndv: 1.0, count: 1.0], [bucket id: 4, min: "5", max: "5", ndv: 1.0, count: 1.0] │ -│ name │ 5 │ [bucket id: 0, min: "Alice", max: "Alice", ndv: 1.0, count: 1.0], [bucket id: 1, min: "Bob", max: "Bob", ndv: 1.0, count: 1.0], [bucket id: 2, min: "Charlie", max: "Charlie", ndv: 1.0, count: 1.0], [bucket id: 3, min: "Diana", max: "Diana", ndv: 1.0, count: 1.0], [bucket id: 4, min: "Eve", max: "Eve", ndv: 1.0, count: 1.0] │ -└─────────────┴────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ - -INSERT INTO sample (user_id, name, age) VALUES -(6, 'Frank', 40); - --- FUSE_STATISTIC 返回上次估计的结果。要获得最新的估计值,请再次运行 ANALYZE TABLE。 -SELECT * FROM FUSE_STATISTIC('default', 'sample'); - -┌─────────────┬────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ column_name │ distinct_count │ histogram │ -├─────────────┼────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ -│ age │ 4 │ [bucket id: 0, min: "25", max: "25", ndv: 1.0, count: 1.0], [bucket id: 1, min: "28", max: "28", ndv: 1.0, count: 1.0], [bucket id: 2, min: "28", max: "28", ndv: 1.0, count: 1.0], [bucket id: 3, min: "30", max: "30", ndv: 1.0, count: 1.0], [bucket id: 4, min: "35", max: "35", ndv: 1.0, count: 1.0] │ -│ user_id │ 5 │ [bucket id: 0, min: "1", max: "1", ndv: 1.0, count: 1.0], [bucket id: 1, min: "2", max: "2", ndv: 1.0, count: 1.0], [bucket id: 2, min: "3", max: "3", ndv: 1.0, count: 1.0], [bucket id: 3, min: "4", max: "4", ndv: 1.0, count: 1.0], [bucket id: 4, min: "5", max: "5", ndv: 1.0, count: 1.0] │ -│ name │ 5 │ [bucket id: 0, min: "Alice", max: "Alice", ndv: 1.0, count: 1.0], [bucket id: 1, min: "Bob", max: "Bob", ndv: 1.0, count: 1.0], [bucket id: 2, min: "Charlie", max: "Charlie", ndv: 1.0, count: 1.0], [bucket id: 3, min: "Diana", max: "Diana", ndv: 1.0, count: 1.0], [bucket id: 4, min: "Eve", max: "Eve", ndv: 1.0, count: 1.0] │ -└─────────────┴────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ - -ANALYZE TABLE sample; - -SELECT * FROM FUSE_STATISTIC('default', 'sample'); -``` - -┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ column_name │ distinct_count │ histogram │ -├─────────────┼────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ -│ name │ 6 │ [bucket id: 0, min: "Alice", max: "Alice", ndv: 1.0, count: 1.0], [bucket id: 1, min: "Bob", max: "Bob", ndv: 1.0, count: 1.0], [bucket id: 2, min: "Charlie", max: "Charlie", ndv: 1.0, count: 1.0], [bucket id: 3, min: "Diana", max: "Diana", ndv: 1.0, count: 1.0], [bucket id: 4, min: "Eve", max: "Eve", ndv: 1.0, count: 1.0], [bucket id: 5, min: "Frank", max: "Frank", ndv: 1.0, count: 1.0] │ -│ age │ 5 │ [bucket id: 0, min: "25", max: "25", ndv: 1.0, count: 1.0], [bucket id: 1, min: "28", max: "28", ndv: 1.0, count: 1.0], [bucket id: 2, min: "28", max: "28", ndv: 1.0, count: 1.0], [bucket id: 3, min: "30", max: "30", ndv: 1.0, count: 1.0], [bucket id: 4, min: "35", max: "35", ndv: 1.0, count: 1.0], [bucket id: 5, min: "40", max: "40", ndv: 1.0, count: 1.0] │ -│ user_id │ 6 │ [bucket id: 0, min: "1", max: "1", ndv: 1.0, count: 1.0], [bucket id: 1, min: "2", max: "2", ndv: 1.0, count: 1.0], [bucket id: 2, min: "3", max: "3", ndv: 1.0, count: 1.0], [bucket id: 3, min: "4", max: "4", ndv: 1.0, count: 1.0], [bucket id: 4, min: "5", max: "5", ndv: 1.0, count: 1.0], [bucket id: 5, min: "6", max: "6", ndv: 1.0, count: 1.0] │ -└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ diff --git a/docs/cn/sql-reference/10-sql-commands/40-explain-cmds/explain-fragments.md b/docs/cn/sql-reference/10-sql-commands/40-explain-cmds/explain-fragments.md deleted file mode 100644 index 7e0d20a0ca..0000000000 --- a/docs/cn/sql-reference/10-sql-commands/40-explain-cmds/explain-fragments.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: EXPLAIN FRAGMENTS ---- - -展示 SQL 语句的分布式执行计划。 - -此命令将 SQL 语句的执行计划转换为 plan fragments,您可以在其中查看从 Databend 检索所需数据的过程。 - -## 语法 - -```sql -EXPLAIN FRAGMENTS -``` - -## 示例 - -```sql -EXPLAIN FRAGMENTS select COUNT() from numbers(10) GROUP BY number % 3; - -+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| explain | -+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Fragment 0: | -| DataExchange: Shuffle | -| AggregatorPartial: groupBy=[[(number % 3)]], aggr=[[COUNT()]] | -| Expression: (number % 3):UInt8 (Before GroupBy) | -| ReadDataSource: scan schema: [number:UInt64], statistics: [read_rows: 10, read_bytes: 80, partitions_scanned: 1, partitions_total: 1], push_downs: [projections: [0]] | -| | -| Fragment 2: | -| DataExchange: Merge | -| Projection: COUNT():UInt64 | -| AggregatorFinal: groupBy=[[(number % 3)]], aggr=[[COUNT()]] | -| Remote[receive fragment: 0] | -+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -11 rows in set (0.02 sec) -``` \ No newline at end of file diff --git a/docs/cn/sql-reference/20-sql-functions/07-aggregate-functions/aggregate-any.md b/docs/cn/sql-reference/20-sql-functions/07-aggregate-functions/aggregate-any.md deleted file mode 100644 index b603e6f5c9..0000000000 --- a/docs/cn/sql-reference/20-sql-functions/07-aggregate-functions/aggregate-any.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: ANY ---- - -聚合函数。 - -ANY() 函数选择第一个遇到的(非 NULL)值,除非该列的所有行都是 NULL 值。查询可以以任何顺序执行,甚至每次顺序都不同,因此该函数的结果是不确定的。要获得确定的结果,可以使用 'min' 或 'max' 函数代替 'any'。 - -## 语法 - -```sql -ANY() -``` - -## 参数 - -| 参数 | 描述 | -|-----------|--------------| -| `` | 任何表达式 | - -## 返回类型 - -第一个遇到的(非 NULL)值,类型与值相同。如果所有值都是 NULL,则返回值为 NULL。 - -## 示例 - -**创建表并插入示例数据** -```sql -CREATE TABLE product_data ( - id INT, - product_name VARCHAR NULL, - price FLOAT NULL -); - -INSERT INTO product_data (id, product_name, price) -VALUES (1, 'Laptop', 1000), - (2, NULL, 800), - (3, 'Keyboard', NULL), - (4, 'Mouse', 25), - (5, 'Monitor', 150); -``` - -**查询示例:检索第一个遇到的非 NULL 产品名称** -```sql -SELECT ANY(product_name) AS any_product_name -FROM product_data; -``` - -**结果** -```sql -| any_product_name | -|------------------| -| Laptop | -``` \ No newline at end of file