First, I never said the log was in the same database, and indeed, it is
generally another 'file'. But that is not the MAIN point FACT that
differentiate a LOG and what you describe.
The main point, with a log, is that the modifications are done IN THE real
DATABASE file, so indexes, DRI, SQL statements, do not have to be modified
at all, while they will have to be if the 'data' involved in the transaction
was temporary written into ANOTHER 'database'. Furthermore, with a log, when
the transaction is committed, the related element IN THE LOG are deleted
after the relevant locks are removed, and that is all what need to be done!
while if the transaction is rolled-back, the log is read (backward) to undo
the modifications, then the lock are removed.
So, the differences, with a log, where COMMIT does almost nothing and
ROLL-BACK is the undo-er, are:
- the modifications occur in the same database with the data, AFTER the
solution to undo it is stored in the log (rather than storing modified data
in another database... and how will you 'store' a deleted record), so
COMMITING is quite atomic, and rolling-back is safe as long as the log is
not destroyed.
- no need to add special code to perform SELECT, from OUTSIDE the
transaction or from WITHIN the transaction: with 2 files where the data
would reside, you will need special code, to reach the appropriate file,
from WITHIN the transaction (locks don't do lock YOURSELF out, so invoking
the locks to do that part of the job does NOT hold),
- no need to add code to maintain DRI. In fact, if such code would
exists, to maintain DRI between two files, it will be possible to enforce
DRI among linked tables... and it is NOT! (another hint: how an illegal
APPEND inside a transaction reacts? it fails only on COMMIT, or *as soon
as* you try an illegal APPEND, wihtout having to commit the transaction?)
- no need to add special code to build and consult indexes on
'partition' of data. In fact, MS SQL Server 2005 can do that, in some
circumstances, but not Jet.
- no need to modify the queries plans of execution dependant of the fact
you are inside a transaction, or not. (related in part to the index problem
with two data files) Indeed, being inside a transaction, reading your data
is quite complex, and the optimal query plan would probably be quite
different, and again, locks do nothing since these locks are YOURS (within
the transaction).
- no 'merging' of data and no need to conciliate eventual conflict (such
as autonumber, which do NOT turn into random while you are inside a
transaction, or unique constraint, DRI, or whatever), since the data is
already acceptable in the database, or has been rejected while the
transaction was adding/modifying/deleting the data, way way long before you
ever commit the transaction.
- transactions embedded inside transactions do not need special code. With
a different data-file by transaction, you will spawn one data-file per
embedded transaction? And again, imagine the SELECT statements, the DRI, ...
And with LOG, COMMIT is easy. RollBack does not need special conflict
resolution, since the restored data WAS validated, in the previous stage.
See how easy it is in terms or writing code to supply that functionality.
Microsoft project managers know that, why on Earth will they have chosen a
more expensive solution, in time, in possibilities of bug, stability, and
money?
Vanderghast, Access MVP
david said:
Used to be like this. may have changed
Jet writes transactions to a local temp file, which is a kind of mdb,
which you can call a log if you want. When the transaction is committed,
the temp file/log/temp mdb is written to the data mdb, and the temp
file is deleted.
(...)