Table of contents
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Transaction describes database operations bound by integrity rules, which update database states while maintaining consistency. More specifically, a transaction is a sequence of operations that has to be atomic, consistent, isolated, and durable.1
Transaction management allows conflict-free simultaneous work by multiple users.
Transaction is a unit of work.
The Standard Work Unit
The standard work unit then states "in order to achieve good and consistent online transaction time, each online transaction running in the system needs to be small and uniform in size."2
Implementations
PostgreSQL
It is important not to confuse the use of
BEGIN/ENDfor grouping statements in PL/pgSQL with the similarly-named SQL commands for transaction control. PL/pgSQL'sBEGIN/ENDare only for grouping; they do not start or end a transaction. See Section 43.8 for information on managing transactions in PL/pgSQL. Also, a block containing anEXCEPTIONclause effectively forms a subtransaction that can be rolled back without affecting the outer transaction. For more about that see Section 43.6.8.3
In PL/pgSQL in PostgreSQL, whenever a
COMMIToccurs in a procedure, the current transaction is ended and a new transaction is started automatically.4
Oracle Database
PL/SQL in Oracle is similar to PL/pgSQL in PostgreSQL in this case, however, there is still an observable difference in the way new transactions are created. When a
COMMITis performed, the current transaction is ended and a new transaction begins whenever the first SQL statement (particularly, DML commands likeINSERT,UPDATE,DELETE,SELECT) is encountered.4
-
MEIER, Andreas; KAUFMANN, Michael. (2019) SQL & NoSQL Databases. Models, Languages, Consistency Options and Architectures for Big Data Management. Wiesbaden: Springer Vieweg. ISBN 978-3-658-24548-1 ↩︎
-
W.H. Inmon, Daniel Linstedt, Mary Levins (2019) Data Architecture. A Primer for the Data Scientist. Second Edition. Elsevier. ISBN 978-0-12-816916-2. (p.188) ↩︎
-
Structure of PL/pgSQL (2022) PostgreSQL Documentation. ↩︎
-
Oracle vs PostgreSQL – Transaction control statements (2022) MigOps Blog (defunct). ↩︎
Copyright © 2025-2026 Gytis Repečka and Inretio® with ❤️ from 🇱🇹. No "AI" slop!
Content is licenced under Creative Commons BY-NC-ND 3.0 unless stated otherwise. Terms of use.