Skip to content

Commit db621c6

Browse files
committed
Revert "PS-9684 [DOCS] - provide description for uuid-versions.md 8.0"
This reverts commit 7b9f3ba.
1 parent 7b9f3ba commit db621c6

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

docs/uuid-versions.md

+12-19
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
# UUID_VX component
22

3-
The UUID_VX component in Percona Server for MySQL provides functions to work with different versions of Universally Unique Identifiers (UUIDs). It allows for:
4-
5-
* Managing any UUID version: You can handle various UUID versions, including UUIDv1, UUIDv4, and others.
6-
7-
* Generating UUIDs for specific versions: This includes creating time-based UUIDs (versions 1, 6, and 7) and random UUIDs (version 4).
8-
9-
* Enhanced support for UUID-based operations: This adds flexibility in how UUIDs are generated and used within the database.
10-
113
A Universally Unique Identifier (UUID) is a 128-bit number used to identify information uniquely in computer systems. It is often represented as a 32-character hexadecimal string divided into five groups separated by hyphens.
124

135
| Benefit | Description |
@@ -38,10 +30,11 @@ UUID version 4 (UUIDv4) generates a unique identifier using random numbers. This
3830
| Inefficient Indexing | UUIDv4 does not follow any order, causing inefficient indexing. Databases struggle to keep records organized, leading to slower query performance. |
3931
| Fragmentation | The random distribution of UUIDv4 can cause data fragmentation, making database storage less efficient. |
4032
| Storage Space | UUIDs are larger (128 bits) than traditional integer keys, consuming more storage space and memory. |
41-
| Poor Performance | UUIDv4's random nature can lead to poor performance in distributed databases, as it does not follow any order. |
42-
| Poor Indexing | UUIDv4's random nature can lead to poor indexing performance, as it does not follow any order. |
43-
44-
For better performance and efficiency in a distributed database, consider using UUIDv7. UUID version 7 (UUIDv7) creates time-ordered identifiers by encoding a Unix timestamp with millisecond precision in the first 48 bits. Six bits specify the UUID version and variant, while the remaining 74 bits are random. This time-ordering results in nearly sequential values, which helps improve index performance and locality in distributed systems.
33+
34+
35+
For better performance and efficiency in a distributed database, consider using UUIDv7, which incorporates timestamps for some order levels.
36+
37+
UUID version 7 (UUIDv7) creates time-ordered identifiers by encoding a Unix timestamp with millisecond precision in the first 48 bits. It uses 6 bits to specify the UUID version and variant, while the remaining 74 bits are random. This time-ordering results in nearly sequential values, which helps improve index performance and locality in distributed systems.
4538

4639
## Install the UUID_VX component
4740

@@ -71,14 +64,14 @@ The following functions are compatible with all UUID versions:
7164

7265
| Function name | Argument | Description |
7366
|----------------------|----------|---|
74-
| `BIN_TO_UUID_VX()` | One string argument that must be hexadecimal of exactly 32 characters (16 bytes) | The function returns a UUID with binary data from the argument. It returns an error for all other inputs. |
75-
| `IS_MAX_UUID_VX()` | One string argument representing a UUID in standard or hexadecimal form. | The function returns true if the argument is a valid UUID and is a MAX UUID. It returns false for all other inputs. If the argument is NULL, it returns NULL. If the argument cannot be parsed as a UUID, the function throws an error. |
67+
| `BIN_TO_UUID_VX()` | One string argument that must be a hexadecimal of exactly 32 characters (16 bytes) | The function returns a UUID with binary data from the argument. It returns an error for all other inputs. |
68+
| `IS_MAX_UUID_VX()` | One string argument that represents a UUID in standard or hexadecimal form. | The function returns true if the argument is a valid UUID and is a MAX UUID. It returns false for all other inputs. If the argument is NULL, it returns NULL. If the argument cannot be parsed as a UUID, the function throws an error. |
7669
| `IS_NIL_UUID_VX()` | One string argument representing a UUID in standard or hexadecimal form. | The function returns true if the string is a NIL UUID. If the argument is NULL, it returns NULL. If the argument is not a valid UUID, it throws an error. |
77-
| `IS_UUID_VX()` | One string argument representing a UUID in either standard or hexadecimal form. | The function returns true if the argument is a valid UUID. If the argument is NULL, it returns NULL. For any other input, it returns false. |
70+
| `IS_UUID_VX()` | One string argument that represents a UUID in either standard or hexadecimal form. | The function returns true if the argument is a valid UUID. If the argument is NULL, it returns NULL. For any other input, it returns false. |
7871
| `MAX_UUID_VX()` | No argument | This function generates a MAX UUID, which has all 128 bits set to one (FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF). This function result is the opposite of the NIL UUID. |
7972
| `NIL_UUID_VX()` | No argument. | This function generates a NIL UUID, which has all 128 bits set to zero (00000000-0000-0000-0000-000000000000). |
80-
| `UUID_VX_TO_BIN()` | One string argument, formatted as a UUID or in hexadecimal form | The function converts the string argument to its binary representation. |
81-
| `UUID_VX_VARIANT()` | One string argument representing a UUID in either standard or hexadecimal format. | The function returns the UUID version (1-8) or an error if the argument is not a valid UUID or returns NULL if the input is NULL. |
73+
| `UUID_VX_TO_BIN()` | One string argument, formatted as a UUID or in hexadecimal form | The function converts the string arugment to its binary representation. |
74+
| `UUID_VX_VARIANT()` | One string argument that represents a UUID in either standard or hexadecimal format. | The function returns the UUID version (1-8) or an error if the argument is not a valid UUID or returns NULL if the input is NULL. |
8275
| `UUID_VX_VERSION()` | One string representing a UUID in standard or hexadecimal form. | The function returns version of UUID(1-8). The function throws an error if the argument is not a valid UUID in formatted or hexadecimal form or returns a NULL if the argument is NULL. If the argument is a valid UUID string but has an unknown value (outside of the 1-8 range) the function returns `-1`. |
8376

8477

@@ -134,7 +127,7 @@ The following functions generate specific UUID versions:
134127
| UUID Version | Arguement | Description |
135128
|--------------|-----------|---|
136129
| `UUID_V1()` | No argument | Generates a version 1 UUID based on a timestamp. If possible, use UUID_V7() instead. |
137-
| `UUID_V3()` | One or two arguments: The first argument is a string that is hashed with MD5 and used in the UUID; the second argument is optional and specifies a namespace (integer values): DNS: 0, URL: 1 (default), OID: 2, X.500: 3. | Generates a version 3 UUID based on a name. Note: MD5 is outdated and not secure. Use with caution and avoid exposing sensitive data. |
130+
| `UUID_V3()` | One or two arguments: the first argument is a string that is hashed with MD5 and used in the UUID; the second argument is optional and specifies a namespace (integer values: DNS: 0, URL: 1, OID: 2, X.500: 3; default is 1 or URL). | Generates a version 3 UUID based on a name. Note: MD5 is outdated and not secure. Use with caution and avoid exposing sensitive data. |
138131
| `UUID_V4()` | No argument | The function generates a version 4 UUID using random numbers and is similar to the built-in UUID() function. |
139132
| `UUID_V5()` | One or two arguments: the first argument is a string that is hashed with SHA1 and used in the UUID; the second argument is optional and specifies a namespace (integer values: DNS: 0, URL: 1, OID: 2, X.500: 3; default is 1 or URL).| Generates a version 5 UUID based on a name. Note: SHA1 is better than MD5 but still not secure. Use with caution and avoid exposing sensitive data. |
140133
| `UUID_V6()` | No argument | Generates a version 6 UUID based on a timestamp. If possible, use UUID_V7() instead. |
@@ -298,7 +291,7 @@ The following functions are used only with time-based UUIDs, specifically versio
298291
|-----------------------------|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
299292
| UUID_VX_TO_TIMESTAMP() | One string argument | Returns a timestamp string like “2024-05-29 18:04:14.201”. If the argument is not parsable as UUID v.1,6,7, the function throws an error. The function always uses UTC time, regardless of system settings or time zone settings in MySQL. |
300293
| UUID_VX_TO_TIMESTAMP_TZ() | One string argument | Returns a timestamp string with the time zone like “Wed May 29 18:05:07 2024 GMT”. If the argument is not parsable as UUID v.1,6,7, the function throws an error. The function always uses UTC time (GMT time zone), regardless of system settings or time zone settings in MySQL. |
301-
| UUID_VX_TO_UNIXTIME() | One string argument | Returns the number of milliseconds since the Epoch. If the argument is not parsable as UUID versions 1, 6, or 7, the function throws an error. |
294+
| UUID_VX_TO_UNIXTIME() | One string argument | Returns a number of milliseconds since the Epoch. If the argument is not parsable as UUID v.1,6,7, the function throws an error. |
302295

303296
### Timestamp-based function examples
304297

0 commit comments

Comments
 (0)