Chapter 11: jOOQ Keys
Choosing the proper type of keys for our tables has a significant benefit on our queries. jOOQ sustains this statement by supporting a wide range of keys, from the well-known unique and primary keys to the fancy embedded and synthetic/surrogate keys. The most commonly used synthetic identifiers (or surrogate identifiers) are numerical or UUIDs. In comparison with natural keys, surrogate identifiers don't have a meaning or a correspondent in the real world. A surrogate identifier can be generated by a Numerical Sequence Generator (for instance, an identity or sequence) or by a Pseudorandom Number Generator (for instance, a GUID or UUID). Moreover, let me use this context to recall that in clustered environments, most relational databases rely on numerical sequences and different offsets per node to avoid the risk of conflicts. Use numerical sequences instead of UUIDs because they require less memory than UUIDs (a UUID requires 16 bytes, while BIGINT
requires...