tencent cloud

TDSQL Boundless

BATCH LIMIT

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-06-02 20:31:42

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

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백