UPDATE COMMIT_ON_SUCCESS ROLLBACK_ON_FAIL QUEUE_ON_PK 88 TARGET_AFFECT_ROW 1 table_name SET k=k+1 WHERE id=88
UPDATE
only supports updating a single object, i.e., "single-table-syntax" but not "multiple-table-syntax".INSERT
syntax are supported, and only one is described below.COMMIT_ON_SUCCESS
: Immediately commits a successful update, which is applicable to a single statement as a transaction.ROLLBACK_ON_FAIL
: Immediately performs rollback if update fails, which is applicable to a single statement as a transaction.QUEUE_ON_PK expr
: Specifies the hotspot update object and locks/unlocks the updated object. The total number of updated objects cannot exceed hot_commodity_query_size
, i.e., the number of exprs
with different values cannot exceed hot_commodity_query_size
. The value of expr
is arbitrary, but it is recommended to keep it the same as the primary key (a different value is also acceptable though).TARGET_AFFECT_ROW expr
: Specifies the data row affected by hotspot update, where expr
is a positive integer ([1, MAX] with MAX being the maximum 8-digit number). Generally, expr
is 1, indicating that only one row will be affected.UPDATE COMMIT_ON_SUCCESS ROLLBACK_ON_FAIL QUEUE_ON_PK 88 TARGET_AFFECT_ROW 1 table_name SET k=k+1 WHERE id=88
CREATE DATABASE hc_db;CREATE TABLE hc_tbl(a INT PRIMARY KEY, b INT, c INT);CREATE TABLE hc_tbl_2(a INT PRIMARY KEY, b INT, c INT);
INSERT COMMIT_ON_SUCCESS ROLLBACK_ON_FAIL QUEUE_ON_PK 1 INTO hc_tbl VALUES(1, 1, 1);INSERT COMMIT_ON_SUCCESS ROLLBACK_ON_FAIL QUEUE_ON_PK 1 INTO hc_tbl SET a= 2;INSERT COMMIT_ON_SUCCESS ROLLBACK_ON_FAIL QUEUE_ON_PK 1 INTO hc_tbl_2 SELECT * FROM hc_tbl;
UPDATE COMMIT_ON_SUCCESS ROLLBACK_ON_FAIL QUEUE_ON_PK 1 TARGET_AFFECT_ROW 1 hc_tbl SET b= b+1 WHERE a = 1;`expr` in `QUEUE_ON_PK expr` is not necessarily the same as that in the WHERE clause.UPDATE COMMIT_ON_SUCCESS ROLLBACK_ON_FAIL QUEUE_ON_PK 2 TARGET_AFFECT_ROW 1 hc_tbl SET b= b+1 WHERE a = 1;
Parameter Name | Feature | Type | Default Value | Remarks |
hot_commodity _enable | Enables/Disables hotspot update | Boolean | true : Enables hotspot update | If this parameter is disabled during execution, hotspot update will no longer apply to new transactions. You are recommended to set it before the system starts instead of changing it during execution |
hot_commodity_trace | Enables/Disables trace | Boolean | false : Disables trace | When it is enabled, trace information will be exported to standard output |
hot_commodity_query_size | Controls the number of hotspot objects that can be updated/inserted | Numeric | 10000 | It is used for throttling |
hot_commodity_query_size_modify_enable | Controls whether hot_commodity_query_size can be modified | Boolean | false : hot_commodity _query_size cannot be modified | It facilitates the modification of hot_commodity_query_size in unit test |
hot_commodity_enable
parameter is disabled, you need to enable it and restart the server before you can initialize the global data table. However, if hot_commodity_query_size
is 0, even if the hot_commodity_enable
parameter is enabled, hotspot update is still unavailable. Therefore, it is also necessary to set the following:hot_commodity_enable
=ONhot_commodity_query_size
=10000; it is a value greater than 0 that preferably falls between 10,000 and 20,000, depending on the hardware environment and application pressure.
Was this page helpful?