Thursday, November 19, 2009

Read Consistency

Read Consistency :
  • Read consistency guarantees a consistent view of the data at all times.
  • Changes made by one user do not conflict with changes made by another user.
  • Read consistency ensures that on the same data :
  • Readers do not wait for writers
  • Writers do not wait for readers
Implementation of Read Consistency :

Wednesday, November 18, 2009

State of the Data Before COMMIT or ROLLBACK

  • The previous state of the data can be recovered.
  • The current user can review the results of the DML operations by using the SELECT statement.
  • Other users cannot view the results of the DML statements by the current user.
  • The affected rows are locked; other users cannotchange the data in the affected rows.
State of the Data After COMMIT :
  • Data changes are made permanent in the database.
  • The previous state of the data is permanently lost.
  • All users can view the results.
  • Locks on the affected rows are released; those rows are available for other users to
    manipulate.
  • All savepoints are erased.
Committing Data :

Make the changes :
  • BEGIN
  • DELETE FROM emp WHERE empno = 7090;
  • INSERT INTO dept VALUES (290, 'Corporate Tax', NULL);
Commit the changes :
  • COMMIT;
State of the Data After ROLLBACK :
Discard all pending changes by using the ROLLBACK statement :
  • Data changes are undone.
  • Previous state of the data is restored.
  • Locks on the affected rows are released.
  • BEGIN;
  • DELETE FROM copy_emp;
  • DELETE 20
  • ROLLBACK ;
  • Rollback

Followers