tencent cloud

TDSQL Boundless

BATCH LIMIT

下载
聚焦模式
字号
最后更新时间: 2026-06-02 20:31:42
本文档由 AI 翻译

Description

The BATCH statement splits large transactions into several small transactions. The entire process does not guarantee atomicity, but each batch maintains atomicity.
Currently, the BATCH statement supports the DELETE operation.

Syntax

BATCH LIMIT batch_size delete_stmt

Parameter Description

Parameter
Required
Description
LIMIT batch_size
Required
Control the granularity of transaction splitting and set the size for each batch of non-transactional batch deletion.
delete_stmt
Required
DELETE statement.

Notes

Multi-table DELETE is not supported.
The BATCH statement cannot be nested within multi-statement transactions.
The batch_size must be a positive integer and cannot be zero.
The ORDER BY and LIMIT clauses are not supported within the WHERE clause.

Examples

As shown below, when 10,000 rows of data are to be deleted and the batch_size is 2000, a transaction is committed for every 2,000 rows during the deletion process. This means each small transaction contains 2,000 rows of data to be deleted.
BATCH LIMIT 2000 DELETE FROM sbtest1 WHERE id > 1000

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈