Tuesday, November 17, 2009

Implicit Transaction Processing

Controlling Transactions :



An automatic commit occurs under the following circumstances :
  • DML is issued
  • DDL statement is issued
  • DCL statement is issued
  • Normal exit from psql, without explicitly issuing COMMIT or ROLLBACK statements
  • An automatic rollback occurs under an abnormal termination of psql or a system failure.
System Failures :
  • When a transaction is interrupted by a system failure, the entire transaction is automatically rolled back. This prevents the error from causing unwanted changes to the data and returns the tables to their state at the time of the last commit. In this way, the PostgreSQL server protects the integrity of the tables.

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 :

Followers