This repository reflects my exploration of PostgreSQL's transaction management capabilities, focusing on a table called bank_accounts
.The steps I follow for this project include creating the table, showcasing atomic transactions, demonstrating rollback scenarios, and delving into various transaction isolation levels.
- Table Creation and Initial Data Insertion
- Atomic Transactions
- Rolling Back Transactions
- Savepoints
- Transaction Isolation Levels
- Conclusion
I created a new table called bank_accounts
, which will store essential information about various bank accounts. Initial data insertion showcases examples with individuals like Charlie, Dora, and Jack.
Then explored the concept of atomic transactions, ensuring a sequence of steps is executed atomically. Examples include debiting and crediting amounts to different accounts within a single transaction block.
Through this project, I Learned how to roll back transactions using the ROLLBACK
command using different scenarios where transactions are rolled back, preserving the integrity of the data.
Savepoints offer flexibility within a transaction. I demonstrate their use in rolling back to specific points, allowing for more nuanced management of changes.
I dived into different transaction isolation levels provided by PostgreSQL and understand their impact on concurrent transactions.
I explored how the READ COMMITTED
isolation level allows changes to be visible only after a transaction is committed.
The REPEATABLE READ
isolation level, prevents changes in the same transaction from affecting subsequent reads.
The SERIALIZABLE
isolation level, prevents concurrent transactions from making changes to the same data simultaneously.
This project provides hands-on experience with SQL commands and transaction management, offering a solid foundation for working with financial data in a relational database.