Skip to content
Merged
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
@@ -1,4 +1,4 @@
---

Check warning on line 1 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-acceleration/materialized-view/async-materialized-view/use-guide.md

View workflow job for this annotation

GitHub Actions / Build Check

seo-title-duplicate

Rendered SEO title is duplicated across indexable pages%3A "最佳实践 | Async Materialized View - Apache Doris". Add a version%2C locale%2C or page-specific qualifier. Owner%3A @apache/doris-website-maintainers

Check warning on line 1 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-acceleration/materialized-view/async-materialized-view/use-guide.md

View workflow job for this annotation

GitHub Actions / Build Check

seo-description-length

SEO description should be 80-160 characters; current length is 20. Owner%3A @apache/doris-website-maintainers
{
"title": "最佳实践 | Async Materialized View",
"language": "zh-CN",
Expand Down Expand Up @@ -37,7 +37,7 @@

- 物化视图使用的表除了分区表外,其他表不经常变化。

- 物化视图的定义 SQL 和分区字段满足分区推导的要求,即符合分区增量更新的要求。详细要求可参考:[CREATE-ASYNC-MATERIALIZED-VIEW](../../../sql-manual/sql-statements/table-and-view/async-materialized-view/CREATE-ASYNC-MATERIALIZED-VIEW#optional-parameters)

Check failure on line 40 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-acceleration/materialized-view/async-materialized-view/use-guide.md

View workflow job for this annotation

GitHub Actions / Build Check

link-missing-anchor

Anchor #optional-parameters does not exist in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/table-and-view/async-materialized-view/CREATE-ASYNC-MATERIALIZED-VIEW.md. Owner%3A @apache/doris-website-maintainers

- 物化视图分区数不多,分区过多会导致分区多物化视图构建时间会过长。

Expand All @@ -47,11 +47,11 @@

## 分区物化视图常见使用方式

当物化视图的基表数据量很大,且基表是分区表时,如果物化视图的定义 SQL 和分区字段满足分区推导的要求,此种场景比较适合构建分区物化视图。分区推导的详细要求可参考 [CREATE-ASYNC-MATERIALIZED-VIEW ](../../../sql-manual/sql-statements/table-and-view/async-materialized-view/CREATE-ASYNC-MATERIALIZED-VIEW#optional-parameters)和[异步物化视图 FAQ 构建问题 12](../../../query-acceleration/materialized-view/async-materialized-view/faq#q12-error-when-building-a-partition-materialized-view)。

Check failure on line 50 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-acceleration/materialized-view/async-materialized-view/use-guide.md

View workflow job for this annotation

GitHub Actions / Build Check

link-missing-anchor

Anchor #q12-error-when-building-a-partition-materialized-view does not exist in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-acceleration/materialized-view/async-materialized-view/faq.md. Owner%3A @apache/doris-website-maintainers

Check failure on line 50 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-acceleration/materialized-view/async-materialized-view/use-guide.md

View workflow job for this annotation

GitHub Actions / Build Check

link-missing-anchor

Anchor #optional-parameters does not exist in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/table-and-view/async-materialized-view/CREATE-ASYNC-MATERIALIZED-VIEW.md. Owner%3A @apache/doris-website-maintainers

物化视图的分区是跟随基表的分区映射创建的,一般和基表的分区是 1:1 或者 1:n 的关系。

- 如果基表的分区发生数据变更,如新增分区、删除分区等情况,物化视图对应的分区也会失效。失效的分区不能用于透明改写,但可以直查。透明改写时发现物化视图的分区数据失效,失效的分区会通过联合基表来响应查询。

Check warning on line 54 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-acceleration/materialized-view/async-materialized-view/use-guide.md

View workflow job for this annotation

GitHub Actions / Build Check

markdown-cjk-spacing

Chinese text should contain spaces around adjacent English words or numbers. Owner%3A @apache/doris-website-maintainers

确认物化视图分区状态的命令详见查看物化视图状态,主要是`show partitions from mv_name`命令。

Expand Down Expand Up @@ -270,7 +270,7 @@

:::tip 提示
自 Apache Doris 2.1.1 版本起支持此功能。
:::

Check warning on line 273 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-acceleration/materialized-view/async-materialized-view/use-guide.md

View workflow job for this annotation

GitHub Actions / Build Check

markdown-cjk-spacing

Chinese text should contain spaces around adjacent English words or numbers. Owner%3A @apache/doris-website-maintainers

物化视图可以只保留最近几个分区的数据,每次刷新时,自动删除过期的分区数据。
可以通过设置物化视图的属性 `partition_sync_limit`,`partition_sync_time_unit`,`partition_sync_date_format` 来实现。
Expand Down Expand Up @@ -330,7 +330,7 @@

比如表 t1,原表的数据量是 1000000,查询语句 SQL 中有 `group by a, b, c`。如果 a,b,c 的基数分别是 100,50,15,那么聚合后的数据大概在 75000 左右,说明此物化视图是有效的。如果 a,b,c 具有相关性,那么聚合后的数据量会进一步减少。

如果 a, b, c 的基数很高,会导致聚合后的数据急速膨胀。如果聚合后的数据比原表的数据还多,可能这样的场景不太适合构建物化视图。比如 c 的基数是 3500,那么聚合后的数据量在 17000000 左右,比原表数据量大的多,构建这样的物化视图性能加速收益低。
如果 a, b, c 的基数很高,分组组合数(基数乘积)会接近甚至超过原表行数,此时聚合几乎不能减少行数(聚合后的行数最多等于原表行数)。比如 c 的基数是 3500,a、b、c 的基数乘积约为 17500000,已远超原表的 1000000 行,聚合后几乎无法减少行数,构建这样的物化视图性能加速收益低。

物化视图的聚合粒度要比查询细,即物化视图的聚合维度包含查询的聚合维度,这样才能提供查询所需的数据。查询可以不写 Group By,同理,物化视图的聚合函数应该包含查询的聚合函数。

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check warning on line 1 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/basic-element/nulls.md

View workflow job for this annotation

GitHub Actions / Build Check

seo-title-duplicate

Rendered SEO title is duplicated across indexable pages%3A "NULL - Apache Doris". Add a version%2C locale%2C or page-specific qualifier. Owner%3A @apache/doris-website-maintainers
{
"title": "NULL",
"language": "zh-CN",
Expand Down Expand Up @@ -28,7 +28,7 @@

下表显示了条件中涉及 NULL 的各种评估的示例。如果在 SELECT 语句的 WHERE 子句中使用计算结果为 UNKNOWN 的条件,那么该查询将不返回任何行。

| **Condition** | **Value of A** | **Evaluation** |
| **Condition** | **Value of a** | **Evaluation** |
| :-------------- | :------------- | :------------- |
| `a IS NULL` | `10` | `FALSE` |
| `a IS NOT NULL` | `10` | `TRUE` |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check notice on line 1 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/array-functions/array-enumerate-uniq.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-section-order

SQL function docs must contain sections in this order%3A Description%2C Syntax%2C Parameters%2C Return Value%2C Example. Missing%3A Example. Owner%3A @zclllyybb
{
"title": "ARRAY_ENUMERATE_UNIQ",
"language": "zh-CN",
Expand All @@ -13,7 +13,7 @@
## 语法
```sql
ARRAY_ENUMERATE_UNIQ(<arr1> [,<arr2> , ... ])
```

Check notice on line 16 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/array-functions/array-enumerate-uniq.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-return-null

Return Value section must document NULL return conditions%2C including when the function never returns NULL. Owner%3A @zclllyybb

Check notice on line 16 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/array-functions/array-enumerate-uniq.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-return-type

Return Value section must state the returned type. Owner%3A @zclllyybb
## 参数
| Parameter | Description |
|---|---|
Expand Down Expand Up @@ -42,6 +42,6 @@
+----------------------------------------------------------------------------------------+
| array_enumerate_uniq(ARRAY(1, 1, 1, 1, 1), ARRAY(2, 1, 2, 1, 2), ARRAY(3, 1, 3, 1, 3)) |
+----------------------------------------------------------------------------------------+
| [1, 1, 2, 1, 3] |
| [1, 1, 2, 2, 3] |
+----------------------------------------------------------------------------------------+
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check notice on line 1 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/json-functions/json-exists-path.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-section-order

SQL function docs must contain sections in this order%3A Description%2C Syntax%2C Parameters%2C Return Value%2C Example. Missing%3A Example. Owner%3A @zclllyybb

Check warning on line 1 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/json-functions/json-exists-path.md

View workflow job for this annotation

GitHub Actions / Build Check

seo-description-length

SEO description should be 80-160 characters; current length is 57. Owner%3A @zclllyybb
{
"title": "JSON_EXISTS_PATH",
"language": "zh-CN",
Expand All @@ -19,12 +19,12 @@
## 别名

* JSONB_EXISTS_PATH

Check notice on line 22 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/json-functions/json-exists-path.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-return-null

Return Value section must document NULL return conditions%2C including when the function never returns NULL. Owner%3A @zclllyybb

Check notice on line 22 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/json-functions/json-exists-path.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-return-type

Return Value section must state the returned type. Owner%3A @zclllyybb
## 参数
| 参数 | 描述 |
|--------------|--------------------------------------------------------|
| `<json_str>` | 要包含在 JSON 数组中的元素。可以是任意类型的值,包括`NULL`。如果没有指定元素,则返回一个空数组。
| `<path>` | 要插入的 JSON 路径。如果是 `NULL` ,则返回 NULL |
| `<json_str>` | 要检查的 JSON 字符串。如果是 `NULL`,则返回 NULL |
| `<path>` | 要判断是否存在的 JSON 路径。如果是 `NULL`,则返回 NULL |

## 返回值
如果存在返回 TRUE,不存在返回 FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check notice on line 1 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-section-order

SQL function docs must contain sections in this order%3A Description%2C Syntax%2C Parameters%2C Return Value%2C Example. Missing%3A Parameters. Owner%3A @zclllyybb

Check warning on line 1 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md

View workflow job for this annotation

GitHub Actions / Build Check

seo-description-length

SEO description should be 80-160 characters; current length is 62. Owner%3A @zclllyybb
{
"title": "JSON_TYPE",
"language": "zh-CN",
Expand All @@ -23,7 +23,7 @@
## 语法

```sql
STRING JSON_TYPE( <json> )
STRING JSON_TYPE( <json>, <path> )
```

## 别名
Expand All @@ -35,6 +35,7 @@
| 参数 | 描述 |
|------|------|
| `<json>` | 需要检查类型的 JSON 字符串。 |
| `<path>` | 要检查类型的字段的 JSON 路径。 |


## 返回值
Expand All @@ -49,11 +50,11 @@
## 注意事项

JSON_TYPE 返回的是 JSON 文档中最外层的值的类型。如果 JSON 文档包含多个不同类型的值,则返回最外层值的类型。
对于无效的 JSON 字符串,JSON_TYPE 会返回 NULL。

Check notice on line 53 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-example-output

Every fenced sql query in Example must be followed by a fenced text block with expected output. Owner%3A @zclllyybb
参考 [json tutorial](../../../basic-element/sql-data-types/semi-structured/JSON) 中的示例


## 示例

Check notice on line 57 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-example-output

Every fenced sql query in Example must be followed by a fenced text block with expected output. Owner%3A @zclllyybb
1. JSON 为字符串类型

```sql
Expand All @@ -63,7 +64,7 @@
```sql
+-------------------------------------------------------------------+
| jsonb_type(cast('{"name": "John", "age": 30}' as JSON), '$.name') |
+-------------------------------------------------------------------+

Check notice on line 67 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-example-output

Every fenced sql query in Example must be followed by a fenced text block with expected output. Owner%3A @zclllyybb
| string |
+-------------------------------------------------------------------+
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check warning on line 1 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/elt.md

View workflow job for this annotation

GitHub Actions / Build Check

seo-description-length

SEO description should be 80-160 characters; current length is 20. Owner%3A @zclllyybb
{
"title": "ELT",
"language": "zh-CN",
Expand Down Expand Up @@ -34,13 +34,13 @@
## 举例

```sql
SELECT ELT(1, 'aaa', 'bbb'),ELT(2, 'aaa', 'bbb'), ELT(0, 'aaa', 'bbb'),ELT(2, 'aaa', 'bbb')
SELECT ELT(1, 'aaa', 'bbb'), ELT(2, 'aaa', 'bbb'), ELT(0, 'aaa', 'bbb')
```

```text
+----------------------+----------------------+----------------------+----------------------+
| elt(1, 'aaa', 'bbb') | elt(2, 'aaa', 'bbb') | elt(0, 'aaa', 'bbb') | elt(2, 'aaa', 'bbb') |
+----------------------+----------------------+----------------------+----------------------+
| aaa | bbb | NULL | bbb |
+----------------------+----------------------+----------------------+----------------------+
+----------------------+----------------------+----------------------+
| elt(1, 'aaa', 'bbb') | elt(2, 'aaa', 'bbb') | elt(0, 'aaa', 'bbb') |
+----------------------+----------------------+----------------------+
| aaa | bbb | NULL |
+----------------------+----------------------+----------------------+
```
Loading