v.24.5New Feature
Added SQL Functions for UUID Version 7 and Extraction Methods
Added a new SQL functiongenerateUUIDv7to generate version 7 UUIDs aka. timestamp-based UUIDs with random component. Also added a new functionUUIDToNumto extract bytes from a UUID and a new functionUUIDv7ToDateTimeto extract timestamp component from a UUID version 7. #62852 (Alexey Petrunyaka).
Why it matters
This feature provides support for version 7 UUIDs that combine a timestamp with randomness, enabling better sorting and time extraction capabilities. It addresses the need for UUIDs that are both unique and time-ordered, enhancing data organization and time-based querying in ClickHouse.How to use it
Use the functiongenerateUUIDv7() in your SQL queries to create version 7 UUIDs. To extract the raw numeric bytes of any UUID, use UUIDToNum(uuid). To obtain the datetime from a version 7 UUID, use UUIDv7ToDateTime(uuidv7).