tx_split - Splitting big transactions into smaller TX-groups
tx_split -f filename [-c commitrate] [-s waitsec] [-k] [-w] [-Y]
tx_split is an Esql/C-program that can be used to split SQL update/delete statements into several smaller transaction groups. This avoids the danger of locktable overflow or a long transaction.
The SQL-statements which should be splitted will be read from the file specified with the -f option.
The default is 1000 rows.
tx_split can only execute the following types of SQL-statements:
- database - update - delete - some other SQL-statements (i.e. "set isolation to...", "set constraints...", -> you have to check the sourcecode)
SQL-statements (like insert or select) will be skipped by tx_split.
This environment variable could be set for debugging purposes (DIAGNOSTICS).
# -------------------------------------------------------------- # choose database (only database-, no connect-statement allowed) # -------------------------------------------------------------- database stores7;
# ---------------------------------- # delete all rows from table "state" # ---------------------------------- delete from state;
# --------------------------------------- # update certain rows in table "customer" # --------------------------------------- update customer set fname = "Eric" where customer_num between 100 and 110;
# ------------------- # choose new database # ------------------- database stores_demo;
# ---------------------------------------- # update on table "orders" with sub-select # ---------------------------------------- update orders set order_date = today where customer_num in ( select customer_num from customer where lname matches "H*"; )
tx_split -f upd_stores.tx_split -c 20 -Y
------------------------------------------------------------------------------ Time.....: 11.07.2000 - 14:32 Action...: ["./tx_split" started on host "tbva03"] ------------------------------------------------------------------------------
[2000-07-11 14:37:55] < UPDATE mode , data will be modified... > [2000-07-11 14:37:55] < DATABASE STORES7 > [2000-07-11 14:37:55] < Current SQL(1): [DELETE FROM STATE] > [2000-07-11 14:37:55] < 20 rows processed so far... > [2000-07-11 14:37:55] < 40 rows processed so far... > [2000-07-11 14:37:55] < 52 rows processed, READY > [2000-07-11 14:37:55] < Current SQL(2): [UPDATE CUSTOMER SET FNAME = "Eric" WHERE CUSTOMER_NUM BETWEEN 100 AND 110] > [2000-07-11 14:37:55] < 10 rows processed, READY > [2000-07-11 14:37:55] < DATABASE STORES_DEMO > [2000-07-11 14:37:55] < Current SQL(4): [UPDATE ORDERS SET ORDER_DATE = TODAY WHERE CUSTOMER_NUM IN ( SELECT CUSTOMER_NUM FROM CUSTOMER WHERE LNAME MATCHES "H*" )] > [2000-07-11 14:37:55] < 5 rows processed, READY >
------------------------------------------------------------------------------ Time.....: 11.07.2000 - 14:32 Action...: ["./tx_split" finished] ------------------------------------------------------------------------------
Debugging can be turned on by setting the environment variable DEBUG_TX_SPLIT before starting tx_split.
The debug-information could be saved with the use of I/O-redirection.
export DEBUG_TX_SPLIT=1 tx_split -f upd_stores.tx_split -c 20 -Y > tx_split.out 2>&1
tx_split will deliver the following returncodes:
0=RET_OK Program finished successfully
1=RET_ERR Program encountered erros