UUID Type¶
MatrixOne’s native UUID stores a 128-bit value in 16 bytes. Clients render it in the canonical 36-character form aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee. The rendered form is not its storage type. MySQL has no native UUID column type.
UUID() and UUID_V7() generate UUIDv7; UUID_V1() explicitly generates v1. UUIDv7 places its millisecond timestamp first and supports time ordering at millisecond granularity. It is not a secret and does not guarantee generation order within a millisecond or across devices. See UUID() for generation, deterministic time boundaries and binary conversion.
Supported operations¶
UUID columns support primary keys, insertion, update, deletion, comparisons, grouping, ordering, and MIN, MAX, and COUNT. Valid UUID text can be converted to the native type. Comparing a native UUID with invalid UUID text raises an error; cast the UUID to CHAR when ordinary text semantics are required.
CTAS over a native UUID expression preserves the UUID column type. Mixed UUID and character value expressions use a character type wide enough to preserve the complete UUID. UUID/NULL-only expressions remain native. These rules do not imply full MySQL string or collation compatibility.
Example¶
DROP TABLE IF EXISTS uuid_names;
CREATE TABLE uuid_names (
id UUID DEFAULT UUID() PRIMARY KEY,
name VARCHAR(32) NOT NULL
);
INSERT INTO uuid_names (name) VALUES ('Tom'), ('Jane');
SELECT UUID_EXTRACT_VERSION(id), LENGTH(CAST(id AS CHAR)), name
FROM uuid_names ORDER BY name;
-- Each row has version 7 and a 36-character representation.
-- 0 for each row
SELECT CAST(id AS CHAR) IN ('fallback') FROM uuid_names;
DROP TABLE uuid_names;