Shadow columns are hidden columns on replicated tables that store values supplied by the database server. They are used for internal replication operations and can be added with CREATE TABLE or ALTER TABLE. To see their content you must list them explicitly in SELECT; SELECT * does not return shadow columns.
Three Essential Shadow Column Types
| Shadow Column | Purpose | Visible (index/catalog) | Create Syntax | Add Syntax | Query Example |
|---|---|---|---|---|---|
| CRCOLS | Conflict resolution (cdrserver, cdrtime) |
Hidden | CREATE TABLE t (...) WITH CRCOLS; |
ALTER TABLE t ADD CRCOLS; |
SELECT cdrserver, cdrtime FROM t; |
| REPLCHECK | Faster consistency checking (ifx_replcheck) |
Visible | CREATE TABLE t (...) WITH REPLCHECK; |
ALTER TABLE t ADD REPLCHECK; |
SELECT ifx_replcheck FROM t; |
| ERKEY | Replication key (ifx_erkey_1, ifx_erkey_2, ifx_erkey_3) |
Visible | CREATE TABLE t (...) WITH ERKEY; |
ALTER TABLE t ADD ERKEY; |
SELECT ifx_erkey_1, ifx_erkey_2, ifx_erkey_3 FROM t; |
CRCOLS – Conflict Resolution
When the conflict resolution rule is timestamp, timestamp+SPL, or delete wins, both the source and target replication servers must define the cdrserver and cdrtime columns. If the rule is ignore or always apply, these columns are not required.
REPLCHECK – Consistency Check Acceleration
After adding the ifx_replcheck column, you must create a unique index on the primary key and ifx_replcheck, with ifx_replcheck as the last column. Enterprise Replication uses this index to speed up consistency checks.
CREATE UNIQUE INDEX customer_index ON customer(id, ifx_replcheck);
ERKEY – Replication Key
These columns are added automatically when a table is created through the grid. A unique index and constraint are created on ifx_erkey_1, ifx_erkey_2, and ifx_erkey_3, and Enterprise Replication uses them as the replication key.
Shadow columns are fundamental to GBase 8s enterprise replication. Leveraging CRCOLS, REPLCHECK, and ERKEY correctly helps you build a robust gbase database replication environment with reliable conflict detection, fast consistency validation, and clear replication identity.
Top comments (0)