Db2 – IBM DB2 Timetravel logging based on some criteria

db2temporal-tables

I have been searching for the condition, where, lets say when we enable time travel to a certain table in DB2 , but don't want to capture all the updates done, but only the updates that's done by some specific user.

Wanted to know if this is at all possible with the DB2 time travel and how we can achieve it .

Best Answer

With Db2 (LUW) Temporal Tables, there is not any option to exclude updates from a certain user.

However, the SET_MAINT_MODE_RECORD_NO_TEMPORALHISTORY procedure is available, and can be called by a user (if a user is granted permission on it), and this will disable the recording of temporal history for system-period temporal tables with the the duration of the current session.

https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.sql.rtn.doc/doc/r0060661.html

Set the internal option to disable recording of temporal history for a system-period temporal table and allow values to be specified for the special temporal columns.