Monday, November 16, 2009

Database Transactions

A database transaction consists of one of the following :
  • DML statements that constitute one consistent change to the data
  • One DDL statement
  • One data control language (DCL) statement
  • PostgreSQL commit automatically when you perform a transaction.
  • You can explicitly start a transaction using BEGIN keyword.
  • Transaction that are explicitly started using BEGIN end with one of the following events:
    • A COMMIT or ROLLBACK statement is issued.
    • The user exits psql.
    • The system crashes.
Advantages of COMMIT and ROLLBACK Statements :
With COMMIT and ROLLBACK statements, you can :
  • Ensure data consistency
  • Preview data changes before making changes permanent
  • Group logically related operations

Controlling Transactions :

No comments:

Post a Comment

Followers