Start of change

SYSTIME_PERIOD_ADJUST built-in global variable

FL 507 The SYSTIME_PERIOD_ADJUST built-in global variable contains a string value that indicates the action that Db2 takes when a history row for a system-period temporal table is generated with an end timestamp that is less than the begin timestamp.

The SYSTIME_PERIOD_ADJUST global variable has the following characteristics:
  • It is updatable, with values maintained by the user.
  • The type is CHAR(1).
  • The schema is SYSIBMADM.
  • The scope of this global variable is session.

The SYSTIME_PERIOD_ADJUST global variable can be set to the following values:

N
No timestamp value adjustments are made when the end timestamp is less than the start timestamp for a history row that is being inserted. Instead, the transaction that is attempting to insert the history row fails and an error is returned. Not allowing adjustments ensures that all history rows generated during the transaction have the same end timestamp and can easily be identified using that end timestamp. N is the default value
Y
When timestamp conflicts are detected, Db2 adjusts the timestamp values for the row-begin column for the system-period temporal table and the row-end column for the generated history row. A warning message is returned. The timestamp values are adjusted by modifying the end timestamp to be greater than the start timestamp by 1 microsecond. This adjustment ensures that the end timestamp is greater than the start timestamp for the history row.

Notes for SYSTIME_PERIOD_ADJUST

  • Db2 issues the +20528 SQL code when the adjustment is made.
  • Since the adjusted timestamp value is used instead of transaction-start-ID, some rows may no longer qualify as a result set if queries in the application are using transaction-start-ID as the time criteria. You must evaluate queries in your applications to prevent missing any output records.
  • When the same row in a system-period temporal table is updated multiple times in a transaction, Db2 inserts more than one row in the history table if the transaction-start-ID column is defined as NULL. You can define the transaction-start-ID column as NOT NULL to ensure only one row is stored in the history table.
  • If SYSTIME_PERIOD_ADJUST is set to 'Y', Db2 adjusts the row-begin timestamp value to avoid the possibility of issuing SQL code -20528 when switching from daylight saving time to standard time.
  • The SYSIBMADM.SYSTIME_PERIOD_ADJUST global variable takes effect only when the SYSIBM.TEMPORAL_LOGICAL_TRANSACTIONS and SYSIBM.TEMPORAL_LOGICAL_TRANSACTION_TIME built-in global variables are not specified.
  • SYSTIME_PERIOD_ADJUST applies only to user tables that are defined as system-period temporal tables, not Db2 catalog tables.
End of change