mysql system databasetdsql_auto_increment_batch_size, with a default value of 100.tdsql_auto_increment_batch_size = 1, you can ensure that auto-increment values are both globally unique and strictly sequential.t1 is created where the auto-increment column id forms a composite primary key with f1:CREATE TABLE `t1` (`id` int NOT NULL AUTO_INCREMENT,`f1` int NOT NULL,`f2` int DEFAULT NULL,PRIMARY KEY (`id`,`f1`)) DEFAULT CHARSET=utf8mb4;
id = 1:-- Using system-generated auto-increment.insert into t1(f1, f2) values(1,1);
id = 1 and perform the write commit:-- The user manually specified the auto-increment.insert into t1(id, f1, f2) values(1, 1,1);
id values. Therefore, when an auto-increment column is defined, it is recommended to define it as a standalone primary key/unique index.Item | TDSQL Boundless | MySQL (before 8.0.29) | MySQL (8.0.29+) |
Default Character Set | utf8mb3 | utf8mb3 | utf8mb4 |
Default Collation | utf8_general_ci | utf8_general_ci | utf8mb4_0900_ai_ci |
/*# broadcast */ SQL hint to broadcast a query to all nodes in the instance. This is useful for commands that are otherwise node-specific. For example,SET GLOBAL command only sets a variable on a single node. To apply a setting globally, use /*# broadcast */ SET GLOBAL to broadcast it to all nodes.SHOW PROCESSLIST displays the processlist for the currently connected node. To view the processlist for all nodes, use /*# broadcast */SHOW PROCESSLIST; or SELECT * FROM information_schema.processlist.general_log and the slow query log slow_log can only be output to files. They cannot be configured to output to a table via SET GLOBAL log_output=TABLE.ADD COLUMN DEFAULT (a+a)), or altering tables with triggers—are not supported online in TDSQL Boundless. If errors occur during such DDL operations, disable Online DDL mode by executing set tdsql_use_online_copy_ddl = 0 before retrying.ADD COLUMN DEFAULT (a+a)), or modifying tables involving triggers, disable Online DDL mode by executing set tdsql_use_online_copy_ddl = 0 before retrying. Note that disabling Online DDL mode will lock the table and block writes to it during DDL execution.INSERT ... ON DUPLICATE KEY UPDATE statement, you adopt a uniform writing style by consistently omitting the primary key. This ensures a consistent locking order across all transactions.INSERT ... ON DUPLICATE KEY UPDATE statement and detects a primary key conflict, it immediately switches to performing an UPDATE operation. It does not lock the unique index on the table to verify the unique index constraint.tdsql_stmt_optim_batch_upsert = ON). Even after a primary key conflict is detected, this mechanism continues to lock the table's unique index to verify uniqueness. If concurrent SQL statements are written inconsistently, resulting in opposite locking orders, deadlocks may occur.INSERT ... ON DUPLICATE KEY UPDATE statements concurrently operate on the same record.t1 with a unique index on the uk_col field:CREATE TABLE t1 (id BIGINT PRIMARY KEY AUTO_INCREMENT,uk_col INT NOT NULL,col VARCHAR(255),UNIQUE KEY idx_uk (uk_col)) DEFAULT CHARSET=utf8mb4;INSERT INTO t1 VALUES (100, 100, 'init');
id field and detects a primary key conflict, it locks the primary key first and then the unique key. In contrast, Transaction B updates without the primary key field, locking the unique key first and then the primary key. This opposite locking order can potentially lead to a deadlock:-- Transaction A: With primary key id → Locks the primary key first, then the unique keyINSERT INTO t1 (id, uk_col, col) VALUES (100, 100, 'session a') ON DUPLICATE KEY UPDATE;-- Transaction B: Without primary key id → Locks the unique key first, then locates the primary key.INSERT INTO t1 (uk_col, col) VALUES (100, 'session b') ON DUPLICATE KEY UPDATE;-- Transaction A and Transaction B execute with high concurrency → A deadlock may occur.
INSERT ... ON DUPLICATE KEY UPDATE statements uniformly omit the primary key field. This ensures all transactions follow the same locking order and avoids mixing styles that include or omit the primary key.tdsql_stmt_optim_batch_upsert to OFF. This reverts to a row-by-row checking mode, terminates early upon primary key conflict, and stops locking secondary indexes, aligning its behavior with MySQL InnoDB.tdsql_stmt_optim_batch_upsert may impact batch write performance in multi-index scenarios. It is recommended to evaluate your business workload before proceeding.SHOW VARIABLES; and SHOW GLOBAL STATUS; display status information from the currently connected compute node. The information displayed may vary when different compute nodes are connected to.LOCK TABLE-related statements do not lock tables or block business reads and writes. Consequently, operations that rely on LOCK TABLE may be limited, such as the mysqldumper export tool.SET PERSIST tdsql_enable_trigger=ON;.Feature Name | Switch | Default Value | Description |
Trigger | tdsql_enable_trigger | OFF | Not recommended for production use. |
View | tdsql_enable_view | ON | Avoid UPDATE operations on views. Avoid ALTER on view definitions. |
Stored Procedure | tdsql_enable_procedure | ON | Avoid ALTER on procedure definitions. |
Function | tdsql_enable_function | ON | Avoid ALTER modifications to FUNCTION. |
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback