Apache Ignite SQL Documentation

The Apache Ignite SQL Developer Hub

Welcome to the Apache Ignite SQL developer hub. You'll find comprehensive guides and documentation to help you start working with Apache Ignite SQL as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Transactions

Ignite supports the following statements that allow users to start, commit or rollback a transaction.

BEGIN [TRANSACTION]

COMMIT [TRANSACTION]

ROLLBACK [TRANSACTION]   
  • The BEGIN statement begins a new transaction.
  • COMMIT commits the current transaction.
  • ROLLBACK rolls back the current transaction.

Limitations

DDL statements are not supported inside transactions.

Description

The BEGIN, COMMIT and ROLLBACK commands allow you to handle SQL Transactions. A transaction is a sequence of SQL operations that starts with the BEGIN statement and ends with the COMMIT statement. The operations in a transaction either all succeed or all fail.

The ROLLBACK [TRANSACTION] statement undoes all updates made since the last time a COMMIT or ROLLBACK command was used.

Example

Add a person and update the city population by 1 in a single transaction.

BEGIN;

INSERT INTO Person (id, name, city_id) VALUES (1, 'John Doe', 3);

Update City SET population = population + 1 where id = 3;

COMMIT;

Roll back the changes made by the previous commands.

BEGIN;

INSERT INTO Person (id, name, city_id) VALUES (1, 'John Doe', 3);

Update City SET population = population + 1 where id = 3;

ROLLBACK;