# info > BEGIN

---
type: CommandReference
command: BEGIN
mode: man
section: 7
source: man-pages
---

## Quick Reference

- `BEGIN;` — start a transaction block with default settings
- `BEGIN WORK;` — equivalent to `BEGIN` (no effect)
- `BEGIN TRANSACTION;` — equivalent to `BEGIN` (no effect)
- `BEGIN ISOLATION LEVEL SERIALIZABLE;` — start transaction with serializable isolation
- `BEGIN READ WRITE;` — start read-write transaction
- `BEGIN READ ONLY;` — start read-only transaction
- `BEGIN DEFERRABLE;` — start deferrable transaction (PostgreSQL extension)
- `BEGIN ISOLATION LEVEL REPEATABLE READ, READ ONLY, NOT DEFERRABLE;` — combine modes

## Name

`BEGIN` — start a transaction block

## Synopsis

`BEGIN [ WORK | TRANSACTION ] [ transaction_mode [, ...] ]`

where *transaction_mode* is one of:

- `ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }`
- `READ WRITE | READ ONLY`
- `[ NOT ] DEFERRABLE`

## Options

- `WORK`, `TRANSACTION` — optional key words with no effect.
- `ISOLATION LEVEL` — sets the transaction isolation level (see [SET TRANSACTION](https://www.chedong.com/phpMan.php/man/SETTRANSACTION/7/markdown)).
- `READ WRITE` / `READ ONLY` — sets transaction access mode.
- `DEFERRABLE` / `NOT DEFERRABLE` — sets deferrable mode (PostgreSQL extension; see [SET TRANSACTION](https://www.chedong.com/phpMan.php/man/SETTRANSACTION/7/markdown)).

## Description

`BEGIN` initiates a transaction block. All statements following `BEGIN` are executed in a single transaction until an explicit `COMMIT` or `ROLLBACK`. Without `BEGIN`, PostgreSQL runs in autocommit mode: each statement is its own transaction.

Transactions improve performance (less CPU/disk overhead for multiple statements) and ensure consistency: other sessions see only the committed state after all changes.

Specifying isolation level, read/write mode, or deferrable mode is equivalent to executing `SET TRANSACTION` for the new transaction.

## Notes

- `START TRANSACTION` has the same functionality as `BEGIN`.
- Use `COMMIT` or `ROLLBACK` to terminate a transaction block.
- Issuing `BEGIN` inside a transaction block produces a warning but does not change state.
- To nest transactions, use savepoints (see [SAVEPOINT(7)](https://www.chedong.com/phpMan.php/man/SAVEPOINT/7/markdown)).
- Commas between successive *transaction_modes* may be omitted for backward compatibility.

## Examples

To begin a transaction block:

sql
BEGIN;
## Compatibility

`BEGIN` is a PostgreSQL language extension, equivalent to the SQL-standard `START TRANSACTION`. The `DEFERRABLE` mode is also a PostgreSQL extension. In embedded SQL, `BEGIN` has a different meaning; careful attention to transaction semantics is required when porting applications.

## See Also

- [COMMIT(7)](https://www.chedong.com/phpMan.php/man/COMMIT/7/markdown)
- [ROLLBACK(7)](https://www.chedong.com/phpMan.php/man/ROLLBACK/7/markdown)
- [START TRANSACTION(7)](https://www.chedong.com/phpMan.php/man/STARTTRANSACTION/7/markdown)
- [SAVEPOINT(7)](https://www.chedong.com/phpMan.php/man/SAVEPOINT/7/markdown)