Subject | Re: Regular DB maintenance? |
---|---|
Author | Adam |
Post date | 2008-10-10T12:15:23Z |
> Would it be correct then to say that all calls to the DB from my appYes. A transaction is a wrapper around an atomic unit of work. Of
> should always be made within a transaction which I explicitly declare?
course multiple calls to the database can (and should!) occur within a
single transaction if they are the same unit of work.
For example, adding a new customer may involve inserting records into
three or four tables. All the inserts should happen in a single
transaction to make sure that if a problem occurs along the way, you
aren't left with a partial customer.
Many frameworks try and remove transaction concepts in a lowest common
denominator approach, but this causes more problems in the long run
than it solves.
>Simply looking at a row in a table that has garbage will cause the
> Can garbage collection be done by running a command, or can it only be
> done by restoring the DB?
clean up to happen. Superserver has a dedicated thread for the task,
in classic server it is the process that hits the garbage that is
lumped with the task. So just running a select count(*) query against
a table will cause garbage collection to occur.
Running a backup also performs garbage collection on the database
(unless you tell it not to)
Adam