KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Why are UUID's so Powerful for Replication?
PRODUCT: 4D Server | VERSION: 12 | PLATFORM: Mac & Win
Published On: June 17, 2011

In most cases every record in a database must have a unique identifier. Furthermore for replication this is required since each table needs a primary key.

One easy way to handle this in a single database situation is to use the Sequence Number command. This would not work for replication because sequence numbers are per-table and thus per-database. If records are being created in more than one system it is important that the identifiers be universally unique.

4D v12 adds a new feature to easily overcome this challenge: UUID’s. Universally Unique Identifiers are values that are guaranteed to be unique, period. Across all databases everywhere a duplicate UUID will never be intentionally created. Furthermore 4D v12 has the ability to automatically generate UUID's for new records. Thus with the UUID feature it is possible to create records with unique identifiers in any database involved with replication.

Note: It is worth noting that if two different records in two different databases have the same primary key the replication feature considers them to be the same record. I.e. by “different” I mean different to a human. You might know the records represent two different customers, for example, but if the primary keys are the same they are indistinguishable to replication.