The MariaDB Features skill has only this line mentioning UUID:
UUID_v4() and UUID_v7() functions (11.7+) — generate version-4 random or version-7 time-ordered UUIDs; the v7 form is sortable and ideal for primary keys
My observations:
- "ideal for primary keys" is an overstatement. It avoids the problems of
BIGINT, like AUTOINC lock, the chance of using all values and values' predictability. But it's bigger, and a primary key makes all secondary indexes bigger. Also, I'd argue that there is no universal rule. For example, for read-only K/V tables the best PK is usually a VARCHAR.
- If you disagree, note that in the same page you recommend using sequences instead of
AUTO_INCREMENT.
- No mention to the UUID type in this skill. It's mentioned in the MySQL to MariaDB skill, which is loaded in different cases.
UUID() is not mentioned. It returns a UUIDv1.
The MariaDB Features skill has only this line mentioning UUID:
UUID_v4()andUUID_v7()functions (11.7+) — generate version-4 random or version-7 time-ordered UUIDs; the v7 form is sortable and ideal for primary keysMy observations:
BIGINT, like AUTOINC lock, the chance of using all values and values' predictability. But it's bigger, and a primary key makes all secondary indexes bigger. Also, I'd argue that there is no universal rule. For example, for read-only K/V tables the best PK is usually a VARCHAR.AUTO_INCREMENT.UUID()is not mentioned. It returns a UUIDv1.