> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cockroachlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# COMMIT

The `COMMIT` [statement](/docs/stable/sql-statements.md) commits the current [transaction](/docs/stable/transactions.md) or, when using [advanced client-side transaction retries](/docs/stable/advanced-client-side-transaction-retries.md), clears the connection to allow new transactions to begin.

When using [advanced client-side transaction retries](/docs/stable/advanced-client-side-transaction-retries.md), statements issued after [`SAVEPOINT`](/docs/stable/savepoint) are committed when [`RELEASE SAVEPOINT`](/docs/stable/release-savepoint) is issued instead of `COMMIT`. However, you must still issue a `COMMIT` statement to clear the connection for the next transaction.

For non-retryable transactions, if statements in the transaction [generated any errors](/docs/stable/transactions.md#error-handling), `COMMIT` is equivalent to `ROLLBACK`, which aborts the transaction and discards *all* updates made by its statements.

## Synopsis

![commit\_transaction syntax diagram](https://mintcdn.com/cockroachlabs/7gzGESYW_aT0XysP/images/sql-diagrams/v26.3/commit_transaction.svg?fit=max\&auto=format\&n=7gzGESYW_aT0XysP\&q=85\&s=dab80d67c78d07fc901325ed6c8bd375)

## Required privileges

No [privileges](/docs/stable/security-reference/authorization.md#managing-privileges) are required to commit a transaction. However, privileges are required for each statement within a transaction.

## Aliases

In CockroachDB, `END` is an alias for the `COMMIT` statement.

## Example

### Commit a transaction

How you commit transactions depends on how your application handles [transaction retries](/docs/stable/transactions.md#transaction-retries).

#### Client-side retryable transactions

When using [advanced client-side transaction retries](/docs/stable/advanced-client-side-transaction-retries.md), statements are committed by [`RELEASE SAVEPOINT`](/docs/stable/release-savepoint). `COMMIT` itself only clears the connection for the next transaction.

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> BEGIN;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SAVEPOINT cockroach_restart;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> UPDATE products SET inventory = 0 WHERE sku = '8675309';
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> INSERT INTO orders (customer, sku, status) VALUES (1001, '8675309', 'new');
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> RELEASE SAVEPOINT cockroach_restart;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> COMMIT;
```

#### Automatically retried transactions

If you are using transactions that CockroachDB will [automatically retry](/docs/stable/transactions.md#automatic-retries) (i.e., all statements sent in a single batch), commit the transaction with `COMMIT`.

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> BEGIN; UPDATE products SET inventory = 100 WHERE = '8675309'; UPDATE products SET inventory = 100 WHERE = '8675310'; COMMIT;
```

## See also

* [Transactions](/docs/stable/transactions.md)
* [`BEGIN`](/docs/stable/begin-transaction)
* [`RELEASE SAVEPOINT`](/docs/stable/release-savepoint)
* [`ROLLBACK`](/docs/stable/rollback-transaction)
* [`SAVEPOINT`](/docs/stable/savepoint)
* [`SHOW SAVEPOINT STATUS`](/docs/stable/show-savepoint-status)
