This is an automated email from the ASF dual-hosted git repository. kassiez pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push: new 12ece4c1f2e [doc](delete) update delete manual (#1530) 12ece4c1f2e is described below commit 12ece4c1f2eaff1317fc1cfbab916b5b042d478f Author: zhannngchen <zhangc...@selectdb.com> AuthorDate: Fri Dec 20 17:51:59 2024 +0800 [doc](delete) update delete manual (#1530) ## Versions - [ ] dev - [ ] 3.0 - [ ] 2.1 - [ ] 2.0 ## Languages - [ ] Chinese - [ ] English ## Docs Checklist - [x] Checked by AI - [ ] Test Cases Built --- .../Manipulation/DELETE.md | 52 ++++++++ .../current/data-operate/delete/delete-manual.md | 104 +++------------- .../Manipulation/DELETE.md | 48 ++++++++ .../data-operate/delete/delete-manual.md | 137 +++++---------------- 4 files changed, 153 insertions(+), 188 deletions(-) diff --git a/docs/sql-manual/sql-statements/Data-Manipulation-Statements/Manipulation/DELETE.md b/docs/sql-manual/sql-statements/Data-Manipulation-Statements/Manipulation/DELETE.md index fede59a803c..8c58f8ac576 100644 --- a/docs/sql-manual/sql-statements/Data-Manipulation-Statements/Manipulation/DELETE.md +++ b/docs/sql-manual/sql-statements/Data-Manipulation-Statements/Manipulation/DELETE.md @@ -71,6 +71,58 @@ DELETE FROM table_name + table_alias: alias of table + USING additional_tables: If you need to refer to additional tables in the WHERE clause to help identify the rows to be removed, then specify those table names in the USING clause. You can also use the USING clause to specify subqueries that identify the rows to be removed. +#### Returned Results + +Delete command is a SQL command that return results synchronously. The results are classified as follows: + +##### Implementation Success + +If Delete completes successfully and is visible, the following results are returned.`Query OK`indicates success. + +```sql +Query OK, 0 rows affected (0.04 sec) +{'label':'delete_e7830c72-eb14-4cb9-bbb6-eebd4511d251', 'status':'VISIBLE', 'txnId':'4005'} +``` + +##### Submitted Successfully but Invisible + +Doris transaction commit is divided into two steps: commit and release version, only after the completion of the release version step, the results will be visible to the user. + +If the commit has been successful, then it can be assumed that it will eventually be published successfully, Doris will try to wait for a certain period of time after the commit is completed, if the timeout period is exceeded even if the published version is not yet complete, it will be preferred to return to the user, prompting the user that the commit has been completed. + + If Delete has been submitted and executed, but the release version is still not published and visible, the following result will be returned: + +```sql +Query OK, 0 rows affected (0.04 sec) +{'label':'delete_e7830c72-eb14-4cb9-bbb6-eebd4511d251', 'status':'COMMITTED', 'txnId':'4005', 'err':'delete job is committed but may be taking effect later' } +``` + +The result will also return a json string: + +- `affected rows`:Indicates the rows affected by this deletion. Since Doris deletion is currently a logical deletion, this value is constant at 0; + +- `label`:The automatically generated label identifies the import job. Each import job has a Label that is unique within a single database; + +- `status`:Indicates whether the data deletion is visible. If it's visible, the result displays `VISIBLE`; if it's invisible, the result displays `COMMITTED`; + +- `txnId`:The transaction id corresponding to Delete; + +- `err`:This field will display the details of Delete. + +##### Commit Failed, Transaction Cancelled + +If the Delete statement fails to commit, the transaction will be automatically aborted by Doris and the following result will be returned: + +```sql +ERROR 1064 (HY000): errCode = 2, detailMessage = {Cause of error} +``` + +For example, a timeout deletion will return the timeout time and the outstanding `(tablet=replica)` + +```sql +ERROR 1064 (HY000): errCode = 2, detailMessage = failed to delete replicas from job: 4005, Unfinished replicas:10000=60000, 10001=60000, 10002=60000 +``` + #### Note 1. Only conditions on the key column can be specified when using AGGREGATE (UNIQUE) model. diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/data-operate/delete/delete-manual.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/data-operate/delete/delete-manual.md index e4165032e8a..2c3eb18a35f 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/data-operate/delete/delete-manual.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/data-operate/delete/delete-manual.md @@ -24,16 +24,16 @@ specific language governing permissions and limitations under the License. --> -Delete 操作语句通过 MySQL 协议,对指定的 table 或者 partition 中的数据进行按条件删除。Delete 删除操作不同于基于导入的批量删除,它类似 Insert into 语句,是一个同步过程。所有的 Delete 操作在 Doris 中是一个独立的导入作业,一般 Delete 语句需要指定表和分区以及删除的条件来筛选要删除的数据,并将会同时删除 base 表和 rollup 表的数据。 +Delete 操作语句通过 MySQL 协议,对指定的表或分区中的数据进行按条件删除。Delete 删除操作不同于基于导入的批量删除,它类似于 Insert into 语句,是一个同步过程。所有的 Delete 操作在 Doris 中是一个独立的导入作业,一般 Delete 语句需要指定表和分区以及删除的条件来筛选要删除的数据,并将会同时删除 base 表和 rollup 表的数据。 -Delete 操作的语法详见 [DELETE](../../sql-manual/sql-statements/Data-Manipulation-Statements/Manipulation/DELETE) 语法。不同于 Insert into 命令,delete 不能手动指定`label`,有关 label 的概念可以查看 [Insert Into](../../data-operate/import/insert-into-manual) 文档。 +Delete 操作的语法详见 [DELETE](../../sql-manual/sql-statements/Data-Manipulation-Statements/Manipulation/DELETE) 语法。不同于 Insert into 命令,Delete 不能手动指定 `label`,有关 label 的概念可以查看 [Insert Into](../../data-operate/import/insert-into-manual) 文档。 ## 通过指定过滤谓词来删除 ```sql DELETE FROM table_name [table_alias] - [PARTITION partition_name | PARTITIONS (partition_name [, partition_name])] - WHERE column_name op { value | value_list } [ AND column_name op { value | value_list } ...]; + [PARTITION partition_name | PARTITIONS (partition_name [, partition_name])] + WHERE column_name op { value | value_list } [ AND column_name op { value | value_list } ...]; ``` ### 必须的参数 @@ -58,7 +58,7 @@ DELETE FROM table_name [table_alias] - 当选定的 Key 列不存在于某个 Rollup 中时,无法进行 Delete。 -- 条件之间只能是“与”的关系。若希望达成“或”的关系,需要将条件分写在两个 DELETE 语句中; +- 条件之间只能是“与”的关系。若希望达成“或”的关系,需要将条件分写在两个 DELETE 语句中。 - 如果为分区表,需要指定分区,如果不指定,Doris 会从条件中推断出分区。两种情况下,Doris 无法从条件中推断出分区:1) 条件中不包含分区列;2) 分区列的 op 为 not in。当分区表未指定分区,或者无法从条件中推断分区的时候,需要设置会话变量 delete_without_partition 为 true,此时 Delete 会应用到所有分区。 @@ -70,30 +70,30 @@ DELETE FROM table_name [table_alias] ```sql DELETE FROM my_table PARTITION p1 - WHERE k1 = 3; + WHERE k1 = 3; ``` -**2. 删除 my_table partition p1 中 k1 列值大于等于 3 且 k2 列值为 "abc" 的数据行** +**2. 删除 my_table partition p1 中 k1 列值大于等于 3 且 status 列值为 "outdated" 的数据行** ```sql DELETE FROM my_table PARTITION p1 -WHERE k1 = 3 AND k2 = "abc"; +WHERE k1 >= 3 AND status = "outdated"; ``` -**3. 删除 my_table partition p1, p2 中 k1 列值大于等于 3 且 k2 列值为 "abc" 的数据行** +**3. 删除 my_table partition p1, p2 中 k1 列值大于等于 3 且 dt 列值位于 "2024-10-01" 和 "2024-10-31" 之间的数据行** ```sql DELETE FROM my_table PARTITIONS (p1, p2) -WHERE k1 = 3 AND k2 = "abc"; +WHERE k1 >= 3 AND dt >= "2024-10-01" AND dt <= "2024-10-31"; ``` ## 通过使用 Using 子句来删除 ```sql DELETE FROM table_name [table_alias] - [PARTITION partition_name | PARTITIONS (partition_name [, partition_name])] - [USING additional_tables] - WHERE condition + [PARTITION partition_name | PARTITIONS (partition_name [, partition_name])] + [USING additional_tables] + WHERE condition ``` ### 必须的参数 @@ -110,16 +110,16 @@ DELETE FROM table_name [table_alias] ### 注意事项 -此种形式只能在 UNIQUE KEY 模型表上使用 +此种形式只能在 UNIQUE KEY 模型表上使用。 - 只能在表模型 UNIQUE Key 表模型上使用,只能指定 key 列上的条件。 ### 使用示例 -使用`t2`和`t3`表连接的结果,删除`t1`中的数据,删除的表只支持 unique 模型 +使用 `t2` 和 `t3` 表连接的结果,删除 `t1` 中的数据,删除的表只支持 unique 模型。 ```sql --- 创建t1, t2, t3三张表 +-- 创建 t1, t2, t3 三张表 CREATE TABLE t1 (id INT, c1 BIGINT, c2 STRING, c3 DOUBLE, c4 DATE) UNIQUE KEY (id) @@ -160,7 +160,7 @@ DELETE FROM t1 WHERE t1.id = t2.id; ``` -预期结果为,删除了`t1`表`id`为`1`的列 +预期结果为,删除了 `t1` 表 `id` 为 `1` 的行。 ```Plain +----+----+----+--------+------------+ @@ -171,77 +171,13 @@ DELETE FROM t1 +----+----+----+--------+------------+ ``` -## 结果返回 - -Delete 命令是一个 SQL 命令,返回结果是同步的,分为以下几种: - -### 执行成功 - -如果 Delete 顺利执行完成并可见,将返回下列结果,`Query OK`表示成功 - -```sql -mysql> delete from test_tbl PARTITION p1 where k1 = 1; -Query OK, 0 rows affected (0.04 sec) -{'label':'delete_e7830c72-eb14-4cb9-bbb6-eebd4511d251', 'status':'VISIBLE', 'txnId':'4005'} -``` - -### 提交成功,但未可见 - -Doris 的事务提交分为两步:提交和发布版本,只有完成了发布版本步骤,结果才对用户是可见的。若已经提交成功了,那么就可以认为最终一定会发布成功,Doris 会尝试在提交完后等待发布一段时间,如果超时后即使发布版本还未完成也会优先返回给用户,提示用户提交已经完成。若如果 Delete 已经提交并执行,但是仍未发布版本和可见,将返回下列结果 - -```sql -mysql> delete from test_tbl PARTITION p1 where k1 = 1; -Query OK, 0 rows affected (0.04 sec) -{'label':'delete_e7830c72-eb14-4cb9-bbb6-eebd4511d251', 'status':'COMMITTED', 'txnId':'4005', 'err':'delete job is committed but may be taking effect later' } -``` - -结果会同时返回一个 json 字符串: - -- `affected rows`:表示此次删除影响的行,由于 Doris 的删除目前是逻辑删除,因此对于这个值是恒为 0; - -- `label`:自动生成的 label,是该导入作业的标识。每个导入作业,都有一个在单 Database 内部唯一的 Label; - -- `status`:表示数据删除是否可见,如果可见则显示`VISIBLE`,如果不可见则显示`COMMITTED`; - -- `txnId`:这个 Delete job 对应的事务 id; - -- `err`:字段会显示一些本次删除的详细信息。 - -### 提交失败,事务取消 - -如果 Delete 语句没有提交成功,将会被 Doris 自动中止,返回下列结果 - -```sql -mysql> delete from test_tbl partition p1 where k1 > 80; -ERROR 1064 (HY000): errCode = 2, detailMessage = {错误原因} -``` - -比如说一个超时的删除,将会返回 `timeout` 时间和未完成的`(tablet=replica)` - -```sql -mysql> delete from test_tbl partition p1 where k1 > 80; -ERROR 1064 (HY000): errCode = 2, detailMessage = failed to delete replicas from job: 4005, Unfinished replicas:10000=60000, 10001=60000, 10002=60000 -``` - -### 总结 - -对于 Delete 操作返回结果的正确处理逻辑为: - -- 如果返回结果为`ERROR 1064 (HY000)`,则表示删除失败; - -- 如果返回结果为`Query OK`,则表示删除执行成功; - - - 如果`status`为`COMMITTED`,表示数据仍不可见,用户可以稍等一段时间再用`show delete`命令查看结果; - - - 如果`status`为`VISIBLE`,表示数据删除成功。 - ## 相关配置 **TIMEOUT 配置** - insert_timeout - 因为 Delete 本身是一个 SQL 命令且被视为一种特殊的导入,因此删除语句会受 Session 中的`insert_timeout`值影响,可以通过`SET insert_timeout = xxx`来增加超时时间,单位是秒。 + 因为 Delete 本身是一个 SQL 命令且被视为一种特殊的导入,因此删除语句会受 Session 中的 `insert_timeout` 值影响,可以通过 `SET insert_timeout = xxx` 来增加超时时间,单位是秒。 **IN 谓词配置** @@ -253,13 +189,13 @@ ERROR 1064 (HY000): errCode = 2, detailMessage = failed to delete replicas from 用户可以通过 show delete 语句查看历史上已执行完成的删除记录。 -语法如下 +语法如下: ```sql SHOW DELETE [FROM db_name] ``` -使用示例 +使用示例: ```sql mysql> show delete from test_db; diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/Data-Manipulation-Statements/Manipulation/DELETE.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/Data-Manipulation-Statements/Manipulation/DELETE.md index 789fdcf9673..b2fb7d6c2e7 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/Data-Manipulation-Statements/Manipulation/DELETE.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/Data-Manipulation-Statements/Manipulation/DELETE.md @@ -71,6 +71,54 @@ DELETE FROM table_name [table_alias] + table_alias: 表的别名 + USING additional_tables: 如果需要在 WHERE 语句中使用其他的表来帮助识别需要删除的行,则可以在 USING 中指定这些表或者查询。 +#### Returned Results + +Delete 命令是一个 SQL 命令,返回结果是同步的,分为以下几种: + +##### 执行成功 + +如果 Delete 顺利执行完成并可见,将返回下列结果,`Query OK`表示成功 + +```sql +Query OK, 0 rows affected (0.04 sec) +{'label':'delete_e7830c72-eb14-4cb9-bbb6-eebd4511d251', 'status':'VISIBLE', 'txnId':'4005'} +``` + +##### 提交成功,但未可见 + +Doris 的事务提交分为两步:提交和发布版本,只有完成了发布版本步骤,结果才对用户是可见的。若已经提交成功了,那么就可以认为最终一定会发布成功,Doris 会尝试在提交完后等待发布一段时间,如果超时后即使发布版本还未完成也会优先返回给用户,提示用户提交已经完成。若如果 Delete 已经提交并执行,但是仍未发布版本和可见,将返回下列结果 + +```sql +Query OK, 0 rows affected (0.04 sec) +{'label':'delete_e7830c72-eb14-4cb9-bbb6-eebd4511d251', 'status':'COMMITTED', 'txnId':'4005', 'err':'delete job is committed but may be taking effect later' } +``` + +结果会同时返回一个 json 字符串: + +- `affected rows`:表示此次删除影响的行,由于 Doris 的删除目前是逻辑删除,因此对于这个值是恒为 0; + +- `label`:自动生成的 label,是该导入作业的标识。每个导入作业,都有一个在单 Database 内部唯一的 Label; + +- `status`:表示数据删除是否可见,如果可见则显示`VISIBLE`,如果不可见则显示`COMMITTED`; + +- `txnId`:这个 Delete job 对应的事务 id; + +- `err`:字段会显示一些本次删除的详细信息。 + +##### 提交失败,事务取消 + +如果 Delete 语句没有提交成功,将会被 Doris 自动中止,返回下列结果 + +```sql +ERROR 1064 (HY000): errCode = 2, detailMessage = {错误原因} +``` + +比如说一个超时的删除,将会返回 `timeout` 时间和未完成的`(tablet=replica)` + +```sql +ERROR 1064 (HY000): errCode = 2, detailMessage = failed to delete replicas from job: 4005, Unfinished replicas:10000=60000, 10001=60000, 10002=60000 +``` + #### Note 1. 使用聚合类的表模型(AGGREGATE、UNIQUE)只能指定 key 列上的条件。 diff --git a/versioned_docs/version-2.0/data-operate/delete/delete-manual.md b/versioned_docs/version-2.0/data-operate/delete/delete-manual.md index b5a76e4e378..eaa3c4596f5 100644 --- a/versioned_docs/version-2.0/data-operate/delete/delete-manual.md +++ b/versioned_docs/version-2.0/data-operate/delete/delete-manual.md @@ -24,36 +24,35 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - -The DELETE statement conditionally deletes data from a specified table or partition using the MySQL protocol.The Delete operation differs from import-based bulk deletion in that it is similar to the INSERT INTO statement, which is a synchronous process.All Delete operations are a separate import job in Doris. +The DELETE statement conditionally deletes data from a specified table or partition using the MySQL protocol. The DELETE operation differs from import-based bulk deletion in that it is similar to the INSERT INTO statement, which is a synchronous process. All DELETE operations are separate import jobs in Doris. The DELETE statement generally requires the specification of tables and partitions as well as deletion conditions to filter the data to be deleted, and will delete data from both the base and rollup tables. -The syntax of the DELETE statement is detailed in the [DELETE](../../sql-manual/sql-reference/Data-Manipulation-Statements/Manipulation/DELETE) syntax. Unlike the Insert into command, Delete cannot specify `label` manually. For the concept of `label` , refer to the [Insert Into](../../data-operate/import/insert-into-manual) documentation. +The syntax of the DELETE statement is detailed in the [DELETE](../../sql-manual/sql-reference/Data-Manipulation-Statements/Manipulation/DELETE) syntax. Unlike the INSERT INTO command, DELETE cannot specify `label` manually. For the concept of `label`, refer to the [Insert Into](../../data-operate/import/insert-into-manual) documentation. ### Delete by Specifying a Filter Predicate ```sql DELETE FROM table_name [table_alias] - [PARTITION partition_name | PARTITIONS (partition_name [, partition_name])] - WHERE column_name op { value | value_list } [ AND column_name op { value | value_list } ...]; + [PARTITION partition_name | PARTITIONS (partition_name [, partition_name])] + WHERE column_name op { value | value_list } [ AND column_name op { value | value_list } ...]; ``` ### Required Parameters -- table_name: Specify the table from which the data should be deleted; +- table_name: Specify the table from which the data should be deleted. -- column_name: Columns belonging to table_name +- column_name: Columns belonging to table_name. -- op: Logical comparison operators, optional types include: =, >, <, >=, <=, !=, in, not in +- op: Logical comparison operators, optional types include: =, >, <, >=, <=, !=, in, not in. -- value | value_list: Values or lists of values for logical comparisons +- value | value_list: Values or lists of values for logical comparisons. ### Optional Parameters - PARTITION partition_name | PARTITIONS (partition_name [, partition_name]): Specify the name of the partition in which the deletion is to be performed. If the partition does not exist in the table, an error will be reported. -- table_alias: Aliases of the Table +- table_alias: Aliases of the table. ### Note @@ -61,11 +60,11 @@ DELETE FROM table_name [table_alias] - If the selected key column does not exist in a rollup, it cannot be deleted. -- Conditions can only be related to each other by "and". If you want an "or" relationship, you need to write the conditions in two separate DELETE statements; +- Conditions can only be related to each other by "and". If you want an "or" relationship, you need to write the conditions in two separate DELETE statements. -- If the table is partitioned, you need to specify the partition. If not, doris will infer the partition from the condition.In two cases, doris cannot infer the partition from the condition: +- If the table is partitioned, you need to specify the partition. If not, Doris will infer the partition from the condition. In two cases, Doris cannot infer the partition from the condition: - - The condition does not contain a partition column + - The condition does not contain a partition column. - The op for the partition column is "not in". When the partition table does not specify a partition, or a partition cannot be inferred from the condition, you need to set the session variable `delete_without_partition` to true, in which case delete is applied to all partitions. @@ -77,43 +76,43 @@ DELETE FROM table_name [table_alias] ```sql DELETE FROM my_table PARTITION p1 - WHERE k1 = 3; + WHERE k1 = 3; ``` -**2. Delete rows in my_table partition p1 where column k1 is greater than or equal to 3 and column k2 is "abc".** +**2. Delete rows in my_table partition p1 where column k1 is greater than or equal to 3 and column status is "outdated".** ```sql DELETE FROM my_table PARTITION p1 -WHERE k1 = 3 AND k2 = "abc"; +WHERE k1 >= 3 AND status = "outdated"; ``` -**3. Delete rows in my_table partition (p1, p2) where column k1 is greater than or equal to 3 and column k2 is "abc".** +**3. Delete rows in my_table partitions (p1, p2) where column k1 is greater than or equal to 3 and column dt is between '2024-10-01' and '2024-10-31'.** ```sql DELETE FROM my_table PARTITIONS (p1, p2) -WHERE k1 = 3 AND k2 = "abc"; +WHERE k1 >= 3 AND dt >= "2024-10-01" AND dt <= "2024-10-31"; ``` ## Delete via the USING clause ```sql DELETE FROM table_name [table_alias] - [PARTITION partition_name | PARTITIONS (partition_name [, partition_name])] - [USING additional_tables] - WHERE condition + [PARTITION partition_name | PARTITIONS (partition_name [, partition_name])] + [USING additional_tables] + WHERE condition; ``` -### Required parameters +### Required Parameters -- table_name: Specify the table from which the data should be deleted; +- table_name: Specify the table from which the data should be deleted. -- WHERE condition: Specify a condition for selecting rows for deletion; +- WHERE condition: Specify a condition for selecting rows for deletion. -### Optional parameters +### Optional Parameters - PARTITION partition_name | PARTITIONS (partition_name [, partition_name]): Specify the name of the partition in which the deletion is to be performed. If the partition does not exist in the table, an error will be reported. -- table_alias: Aliases of the Table +- table_alias: Aliases of the table. ### Note @@ -141,7 +140,7 @@ CREATE TABLE t3 DISTRIBUTED BY HASH (id) PROPERTIES('replication_num'='1'); --- insert data +-- Insert data INSERT INTO t1 VALUES (1, 1, '1', 1.0, '2000-01-01'), (2, 2, '2', 2.0, '2000-01-02'), @@ -159,13 +158,13 @@ INSERT INTO t3 VALUES (4), (5); --- remove rows from t1 +-- Remove rows from t1 DELETE FROM t1 USING t2 INNER JOIN t3 ON t2.id = t3.id WHERE t1.id = t2.id; ``` -The expected result is that the column with `id=1` in table `t1` is deleted. +The expected result is that the row with `id=1` in table `t1` is deleted. ```Plain +----+----+----+--------+------------+ @@ -176,81 +175,11 @@ The expected result is that the column with `id=1` in table `t1` is deleted. +----+----+----+--------+------------+ ``` -## Returned Results - -Delete command is a SQL command that return results synchronously. The results are classified as follows: - -### Implementation Success - -If Delete completes successfully and is visible, the following results are returned.`Query OK`indicates success. - -```sql -mysql> delete from test_tbl PARTITION p1 where k1 = 1; -Query OK, 0 rows affected (0.04 sec) -{'label':'delete_e7830c72-eb14-4cb9-bbb6-eebd4511d251', 'status':'VISIBLE', 'txnId':'4005'} -``` - -### Submitted Successfully but Invisible - -Doris transaction commit is divided into two steps: commit and release version, only after the completion of the release version step, the results will be visible to the user. - -If the commit has been successful, then it can be assumed that it will eventually be published successfully, Doris will try to wait for a certain period of time after the commit is completed, if the timeout period is exceeded even if the published version is not yet complete, it will be preferred to return to the user, prompting the user that the commit has been completed. - - If Delete has been submitted and executed, but the release version is still not published and visible, the following result will be returned: - -```sql -mysql> delete from test_tbl PARTITION p1 where k1 = 1; -Query OK, 0 rows affected (0.04 sec) -{'label':'delete_e7830c72-eb14-4cb9-bbb6-eebd4511d251', 'status':'COMMITTED', 'txnId':'4005', 'err':'delete job is committed but may be taking effect later' } -``` - -The result will also return a json string: - -- `affected rows`:Indicates the rows affected by this deletion. Since Doris deletion is currently a logical deletion, this value is constant at 0; - -- `label`:The automatically generated label identifies the import job. Each import job has a Label that is unique within a single database; - -- `status`:Indicates whether the data deletion is visible. If it's visible, the result displays `VISIBLE`; if it's invisible, the result displays `COMMITTED`; - -- `txnId`:The transaction id corresponding to Delete; - -- `err`:This field will display the details of Delete. - -### Commit Failed, Transaction Cancelled - -If the Delete statement fails to commit, the transaction will be automatically aborted by Doris and the following result will be returned: - -```sql -mysql> delete from test_tbl partition p1 where k1 > 80; -ERROR 1064 (HY000): errCode = 2, detailMessage = {Cause of error} -``` - -For example, a timeout deletion will return the timeout time and the outstanding `(tablet=replica)` - -```sql -mysql> delete from test_tbl partition p1 where k1 > 80; -ERROR 1064 (HY000): errCode = 2, detailMessage = failed to delete replicas from job: 4005, Unfinished replicas:10000=60000, 10001=60000, 10002=60000 -``` - -### Summary - -The correct logic for handling the results returned by Delete is: - -- If returns `ERROR 1064 (HY000)` , the deletion failed; - -- If returns`Query OK`, the deletion is successful; - - - If `status` is `COMMITTED`, it means that the data is still not visible, users can wait for a while and then check the result with `show delete`; - - - If `STATUS` is `VISIBLE`, the deletion is successful. - ## FE Configurations **TIMEOUT Configurations** -总体来说,Doris 的删除作业的超时时间计算规则为如下(单位:秒): - -Overall, the timeout calculation rules for Doris Delete jobs are as follows (in seconds): +Overall, the timeout calculation rules for Doris DELETE jobs are as follows (in seconds): ```Plain TIMEOUT = MIN(delete_job_max_timeout_second, MAX(30, tablet_delete_timeout_second * tablet_num)) @@ -264,22 +193,22 @@ Assuming that there are 5 tablets under the partition specified for this deletio - `query_timeout` -Because delete itself is a SQL command, the delete statement is also subject to session limitations. Timeout is also affected by the `query_timeout` value in the session, which can be increased in seconds by `SET query_timeout = xxx`. +Because delete itself is a SQL command, the DELETE statement is also subject to session limitations. Timeout is also affected by the `query_timeout` value in the session, which can be increased in seconds by `SET query_timeout = xxx`. **IN Predicate Configuration** - `max_allowed_in_element_num_of_delete` -If the user needs to occupy more elements when using the in predicate, the user can adjust the maximum number of elements allowed to be carried by `max_allowed_in_element_num_of_delete`. The default value is 1024. +If the user needs to occupy more elements when using the IN predicate, the user can adjust the maximum number of elements allowed to be carried by `max_allowed_in_element_num_of_delete`. The default value is 1024. ## View History -Users can view the history of deletions that have been performed by using the show delete statement. +Users can view the history of deletions that have been performed by using the SHOW DELETE statement. ### Syntax ```sql -SHOW DELETE [FROM db_name] +SHOW DELETE [FROM db_name]; ``` ### Example --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org