Using logging and nologging modes
Transaction logging is used for recovery. Logging, in certain cases, can introduce performance problems. When you are not concerned about recovery, you can avoid transaction logging. This may introduce additional work when recovery is needed.
The usual scenario for such operations happens when you need to perform an initialization on a table based on external data, using either LOAD
, INSERT
, or db2move
. When the volume is especially large, the gain in performance is worthwhile.
Getting ready
You may want to perform a backup on the table space or the database, to make recovery easier.
How to do it...
Change logging characteristics on a table. This command disables logging for the current unit or work:
[db2inst1@nodedb21 NODE0000]$ db2 "ALTER TABLE POS.FACTDET ACTIVATE NOT LOGGED INITIALLY" DB20000I The SQL command completed successfully.
How it works...
The alter table
command disables logging until the next commit. When the current unit of work is done, the NOT...