Row versioning
Use row versioning to determine whether a row was changed and to detect collisions. With row versioning enabled, each row of a table is configured to contain both a checksum and a version number. When a row is first inserted, the checksum is generated automatically, and the version is set to 1. Every time the row is updated the version is incremented by one, while the checksum value is not changed. With row versioning, if a row is deleted and another row is reinserted in a table, it is possible to recognize that the row is different. By comparing the row checksum and row version between the secondary and the primary servers, it is possible to detect data collisions.
Web applications can use a version column to determine whether information contained in a previously retrieved object is still current. For example, a web application might display items for sale to a customer. When the customer decides to purchase an item, the application can check the version column of the item's row to determine whether any information about the item has changed.
If client applications can update data on the secondary servers in your environment, use row versioning to minimize network use, especially if your tables have many columns. Otherwise, entire rows on the secondary server are compared with entire rows on the primary server to determine whether updates occurred.
To add row versioning to an existing table, use the following syntax:
ALTER TABLE tablename add VERCOLS;
Similarly, you can delete row versioning from a table with the following syntax:
ALTER TABLE tablename drop VERCOLS;
To create a new table with row versioning, use the following syntax:
CREATE TABLE tablename (
Column Name Datatype
Column Name Datatype
Column Name Datatype
) with VERCOLS;
When row versioning is enabled, ifx_row_version is incremented by one each time the row is updated; however, row updates made by Enterprise Replication do not increment the row version. To update the row version on a server using Enterprise Replication, you must include the ifx_row_version column in the replicate participant definition.