Transaction IDs
- A transaction ID that created the record
- A transaction ID that deleted the record (which is set to 0 if it is not deleted)
When the system updates a record, it deletes the original record, inserts a new record, and preserves the rowid.
Because the system does not update records in place on the disk, data integrity is preserved (write once), and rollback and recovery operations are simplified and accelerated.
When you run a query (or backup operation), the system allows the query to access any record that was created, but not deleted, before this transaction began. Because xid values are sequential, the system compares the create xid and delete xid values to accomplish this.
The exception is that when a transaction begins, it generates an invisibility list of any other active transactions (which would thus have a lower xid value). The transaction ignores any records with a matching create xid value, and includes any records with a matching delete xid value.
An xid is an 8-byte integer value, of which 48 bits are significant. In new installations, the initial xid value is 1,024. The system stores the next available xid value in the /nz/data/xid file.
The size of the xid allows for over 100 trillion transaction IDs, which would take over 4000 years to use up at the rate of one transaction per millisecond. In actual practice, transaction IDs in are likely to be generated at a slower rate and would take longer to exhaust.