UUID v7 vs. v4 + Rust Programming Examples

  Рет қаралды 15,495

Jeremy Chone

Jeremy Chone

Күн бұрын

Quick overview of UUID v7 vs. v4 with some Rust programming and various possible string encodings.
In short:
- UUID v4 is still great for when maximum entropy is needed, such as hashing salts and context-free IDs (e.g., context-free IDs for highly sensitive data).
- UUID v7 is great for database IDs, from single to distributed databases, and when a UUID with time adds value (millisecond precision).
Note on ULID: At the bit level, although developed completely independently, ULID can be seen as a precursor to UUID v7 and is very similar. The first 48 bits are designated for the time, and the rest for randomness. Thus, at the bit level, all UUID v7s are valid ULIDs, but the opposite is not true, as UUID v7 requires specific bits for the version and variant. ULID uses a different standard string serialization that employs BASE 32 to make it shorter while maintaining lexicographical ordering. This serialization is similar to the one we demonstrated in the video with base32hex.
rust10x.com for more production coding in Rust.
== Jeremy Chone:
- Patreon - / jeremychone - Any help is a big help (for Rust educational content)
- Twitter - / jeremychone
- Discord general-rust - / discord
- Discord rust10x - / discord
- Rust10x - rust10x.com - Rust resources for production coding.
Big thanks to CrabNebula (crabnebula.dev/) for sponsoring this channel.
== Rust10x AI / OpenAI / Ollama
- Rust OpenAI API Tutorial: • Learn Rust OpenAI API ...
- Rust Ollama Tutorial: • Rust Ollama By Example...
== Rust10x Web App production coding:
Episode 01: • Rust Axum Production C...
Episode 02: • Rust Sea-Query + SQLX ...
Episode 03: • Rust Workspace Product...
Episode 04: • Rust Argon 2 Password ...
Episode 05.1: • Rust RPC Router - Axum...
Web Site: rust10x.com/we...
GitHub: github.com/rus...
Discord rust10x - / discord
Patreon - / jeremychone - Any help is a big help (for Rust Production Coding educational content)
== Other
Other popular Rust Programming videos:
- Rust Web App Production Coding Blueprint - • Rust Axum Production C...
- Rust Axum - Full Course - • Rust Axum Full Course ...
- Rust Type State Builder Pattern - • Rust Programming: Type...
- Quick Start Code Layout - • Rust - Simple Code Lay...
- AWESOME-APP Full Overview - Rust template for building Awesome Desktop Application: • Building Awesome Deskt...
- Tauri Quick Introduction (Desktop App wit Rust Programming): • Rust Tauri 1.0 - Quick...
- Rust Web App tutorials series: • Rust Web App - 1/3 - D...
- Rust Bevy Full Tutorial - Game Development with Rust: • Rust Bevy Full Tutoria...
- Rust for Java Developers series: • Rust for Java Develope...
Playlists:
- Rust AI Programming Series: • JC - Rust & AI Program...
- Rust Web App Production Coding Series: • JC - Rust Production C...
- Rust For Desktop App: • JC - Rust Programming ...
- Everything Rust Programming - Tutorials, Courses, Tips, Examples: • JC - Rust - Everything...
- Rust Programming for Web Development: • JC - Rust Programming ...
- Rust Courses: • Rust Course 2021 by th...
- Rust for Java Developers: • Rust for Java Developers
Rust10x - Coding Resources for Production Coding in Rust. ➜ rust10x.com
Other notes:
- ScreenBrush for the green lines. (Gromit seems to be the equivalent on Linux)
- Sketchapp for some graphics.
- Davinci Resolve and Fusion video editing.
- VSCode with Google Material icon themes (with some customization)

Пікірлер: 23
@kubre_in
@kubre_in 5 ай бұрын
What a condensed and straightforward explanation that can actually be used in the real world.
@arisweedler4703
@arisweedler4703 5 ай бұрын
TIL UUID v7 & base58. Especially loved the watch cmd and SEEING the 3 v7s lined up next to each other. Made sense before but grokked more fully when I saw the interactivity.
@maxali6591
@maxali6591 5 ай бұрын
The content is as good as usually. The time format is perfect for me.
@weiSane
@weiSane 5 ай бұрын
I wish you were my teacher for a lot of things. I would understand everything so easily and very fast . You are good 👌
@SuperRoli123
@SuperRoli123 5 ай бұрын
Really good explanation on different techniques to store the uuids
@jaimalad2902
@jaimalad2902 5 ай бұрын
Straightforward & to the point, I like it 👍
@foklin9698
@foklin9698 5 ай бұрын
Thanks for making these. I didn't even know about the existence of V7. Also, wonder what impact this will have on other tools such as snowflake, as the main critique of UUID was the database indexing part you said.
@ervinpm
@ervinpm 5 ай бұрын
Thank you for sharing this, I learned a lot! 😊
@midewestmond9442
@midewestmond9442 5 ай бұрын
Thanks always learn new concept from you
@ariseyhun2085
@ariseyhun2085 5 ай бұрын
Really awesome! I'll need to keep this trick in mind
@keshamix_
@keshamix_ 3 ай бұрын
What an awesome video! Just…. Wow
@camorimd
@camorimd 5 ай бұрын
Awesome video as usual
@rolandrodriguez
@rolandrodriguez 5 ай бұрын
Excellent. 👍🏽
@Boronesss
@Boronesss 5 ай бұрын
Happy Coding!
@marcosdantas4258
@marcosdantas4258 5 ай бұрын
Jeremy what is your hardware, because your cargo-watch is really fast, I got impressed.
@JeremyChone
@JeremyChone 5 ай бұрын
So, I have a maxed-out M3 Max. Now, for many of these, it might be a side effect of video editing. But typically, besides the initial compile, the cargo watch for me takes sub-seconds or 1 to 2 seconds. Even for a large project (currently 10K lines of code), where I am typically in a multi-crate setup, I run my `cargo watch ... test` on one library and typically focus on one function during development.
@warriorblood92
@warriorblood92 5 ай бұрын
Thanks for explanation. Though I have 2 queries 1. Can we extract time stamp from v7 string to UTC format? 2. Do we have assurance, u4/u7 will always give totally unique string always? Do they maintain trace? I have fear of conflicting duplicate !
@JeremyChone
@JeremyChone 5 ай бұрын
1) For UUID v7 to time (UTC), the library usually handles that. The lib would convert from string -> bytes -> time by extracting only the first 48 bits. 2) Uniqueness - All those UUIDs, v... and so on, are stateless; each generator does not know about the others. However, the whole design of those uuid is to make the likelihood of a conflict practically impossible, but theoretically, they can occur. There are more avaiable litterature about it on the internet.
@Gordonfreems
@Gordonfreems 5 ай бұрын
What happened to v5 and v6
@JeremyChone
@JeremyChone 5 ай бұрын
Yes, I could have mentioned those. - v5 is more specialized for use cases where we need to generate a UUID based on a SHA-1 namespace and name, making UUIDv5 deterministic and repeatable. - v6 also has a time component, similar to v7, but with a custom format. Typically, we would use v7 over v6 as it uses the well known unix time format.
@CuriousSpy
@CuriousSpy 5 ай бұрын
if you want user-friendly id you can use cuid
@CuriousSpy
@CuriousSpy 5 ай бұрын
but last time i checked - author uses panics
@Mankepanke
@Mankepanke 5 ай бұрын
​@@CuriousSpymaybe a good reason to get into FOSS and send some patches. :)
Rust Toggle End Of Lines - Rust10x VSCode Extension
2:22
Jeremy Chone
Рет қаралды 4,2 М.
5 Steps to Learn Rust Programming
25:06
Jeremy Chone
Рет қаралды 7 М.
Brawl Stars Edit😈📕
00:15
Kan Andrey
Рет қаралды 49 МЛН
Electric Flying Bird with Hanging Wire Automatic for Ceiling Parrot
00:15
Самое неинтересное видео
00:32
Miracle
Рет қаралды 2,7 МЛН
Rust Error Handling - Best Practices
21:33
Jeremy Chone
Рет қаралды 21 М.
Use Arc Instead of Vec
15:21
Logan Smith
Рет қаралды 145 М.
Why does this Rust program leak memory?
35:24
fasterthanlime
Рет қаралды 57 М.
Rust Programming: The Ultimate Builder Pattern Tutorial
20:22
Jeremy Chone
Рет қаралды 39 М.
Don’t Use UUIDs/GUIDs in Databases. Use this Instead
10:36
Nick Chapsas
Рет қаралды 46 М.
Rust's second most complicated feature explained
7:48
Let's Get Rusty
Рет қаралды 33 М.
Why JavaScript Devs are Switching to Rust in 2024
10:35
warpdotdev
Рет қаралды 257 М.
Асинхронный Rust:Stackfull Coroutines vs. Future. Артём Павлов
49:03
Видео с мероприятий {speach!
Рет қаралды 2,9 М.
Dear Functional Bros
16:50
CodeAesthetic
Рет қаралды 506 М.
The effect of Random UUID on database performance
18:51
Hussein Nasser
Рет қаралды 70 М.
Brawl Stars Edit😈📕
00:15
Kan Andrey
Рет қаралды 49 МЛН