tencent cloud

TDSQL Boundless

BATCH LIMIT

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-03-12 12:03:38

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 WHERE clause does not support the use of ORDER BY and LIMIT clauses.

Examples

As shown below, if the data to be deleted consists of 10,000 records with a batch_size of 2,000, a transaction commit is performed for every 2,000 records during deletion; meaning each small transaction contains 2,000 deletion operations.
BATCH LIMIT 2000 DELETE FROM sbtest1 WHERE id > 1000

Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan