COMMIT
Purpose
Use this statement to persistently store changes of the current transaction in the database.
Prerequisite
None
Syntax
commit::=
Usage notes
- The keyword
WORKis optional and is only supported to conform to the SQL standard. - If autocommit is enabled in the client,
COMMITwill be executed automatically after each statement.
To ensure optimal performance we recommend that you group related operations in a single transaction before committing, since cached data is flushed with each commit and therefore not available for subsequent operations.
To learn more about transactions, see Transaction Management.
Examples:
CREATE TABLE t (i DECIMAL);
INSERT INTO t values (1);
COMMIT;
SELECT COUNT(*) FROM t;
-- table's data was already persistently committed
ROLLBACK;
SELECT COUNT(*) FROM t;