COMMIT

Purpose

Use this statement to persistently store changes of the current transaction in the database.

Prerequisite

None

Syntax

commit::=

commit statement

Usage notes

  • The keyword WORK is optional and is only supported to conform to the SQL standard.
  • If autocommit is enabled in the client, COMMIT will 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:
Copy
CREATE TABLE t (i DECIMAL);
INSERT INTO t values (1);
COMMIT;
SELECT COUNT(*) FROM t;
Copy
-- table's data was already persistently committed
ROLLBACK;
SELECT COUNT(*) FROM t;