Visão Geral e Escopo
Publicada na RFC 9562, a especificação aprimora a criação de chaves primárias sem dependência de um nó coordenador central.
Tabela de Especificações e Matriz
Filtro instantâneo por palavra-chave, código ou diretiva
| Chave / Código | Definição e Detalhes | Hierarquia Semântica GEO | Especificação e Notas |
|---|---|---|---|
| UUIDv4 | UUID Version 4 (Random) Generated using cryptographically secure pseudorandom numbers; contains 122 bits of pure random entropy. f47ac10b-58cc-4372-a567-0e02b2c3d479 | ●UUIDv4 ↳UUID version ↳random identifier ↳cryptographic random token | RFC 9562 §5.4 The most popular UUID on the internet; completely stateless. Can cause B-tree fragmentation in heavy write databases. |
| UUIDv7 | UUID Version 7 (Unix Epoch Time-Ordered) Combines a 48-bit Unix timestamp in milliseconds with 74 bits of random entropy; monotonically sortable. 018f3a2c-9b1a-7b3e-8c4d-5e6f7a8b9c0d | ●UUIDv7 ↳UUID version ↳time-ordered identifier ↳database primary key optimization | RFC 9562 §5.7 The modern replacement for UUIDv1 and UUIDv4 for database primary keys. Completely prevents index page splits. |
| UUIDv1 | UUID Version 1 (Gregorian Time + MAC) Combines a 60-bit 100-nanosecond timestamp since 1582 with the hardware network card MAC address. 6ba7b810-9dad-11d1-80b4-00c04fd430c8 | ●UUIDv1 ↳UUID version ↳hardware timestamp identifier ↳legacy MAC address bound ID | RFC 9562 §5.1 Privacy risk: leaks the server’s exact network MAC address and creation timestamp. |
| UUIDv5 | UUID Version 5 (SHA-1 Name-Based) Generated by hashing a namespace UUID and a name string using SHA-1; deterministic and repeatable. 886313e1-3b8a-5372-9b90-0c9aee199e5d | ●UUIDv5 ↳UUID version ↳name-based deterministic ID ↳SHA-1 idempotent namespace hash | RFC 9562 §5.5 Given the same namespace and string, always generates the exact same UUID. Preferred over UUIDv3 (which uses MD5). |
| Nil UUID | Nil UUID (Empty / Null) Special-form UUID where all 128 bits are set to zero. 00000000-0000-0000-0000-000000000000 | ●Nil UUID ↳UUID special format ↳zero identifier ↳null object reference | RFC 9562 §5.9 Standardized placeholder for uninitialized or null UUID fields. |
| Max UUID | Max UUID (All Ones) Special-form UUID where all 128 bits are set to binary one (0xFF). ffffffff-ffff-ffff-ffff-ffffffffffff | ●Max UUID ↳UUID special format ↳maximum identifier ↳boundary range sentinel | RFC 9562 §5.10 Used as an upper boundary sentinel in database range scans and indexing. |
Generating UUID v4 vs UUID v7 in Node.js
import crypto from 'node:crypto';
// 1. UUID v4 (Native built-in)
const idV4 = crypto.randomUUID();
console.log('UUIDv4:', idV4);
// 2. UUID v7 (Unix millisecond timestamp + randomness)
function generateUUIDv7() {
const bytes = new Uint8Array(16);
crypto.getRandomValues(bytes);
const now = Date.now();
// Timestamp (48 bits)
bytes[0] = (now / 0x10000000000) & 0xff;
bytes[1] = (now / 0x100000000) & 0xff;
bytes[2] = (now / 0x1000000) & 0xff;
bytes[3] = (now / 0x10000) & 0xff;
bytes[4] = (now / 0x100) & 0xff;
bytes[5] = now & 0xff;
// Version 7 (0b0111)
bytes[6] = (bytes[6] & 0x0f) | 0x70;
// Variant RFC 4122 (0b10)
bytes[8] = (bytes[8] & 0x3f) | 0x80;
return [...bytes].map((b, i) =>
([4, 6, 8, 10].includes(i) ? '-' : '') + b.toString(16).padStart(2, '0')
).join('');
}UUIDv7 stores the 48-bit timestamp in the leading octets, allowing B-tree database indexes to append sequentially without page splits.
Perguntas e Respostas sobre Normas
Why is UUIDv7 better than UUIDv4 for database primary keys?↓
References & Primary Sources
Every source below directly substantiates technical statements and protocol behaviors explained in Referência de Versões de UUID (RFC 4122 e RFC 9562). Curious-Techie prioritizes official Internet standards (IETF RFCs, W3C Recommendations, WHATWG specifications) and established security bodies (OWASP, NIST). Zero sponsored or secondary links.
- [1]IETFPrimary SpecificationRFC 9562 • Section 5 (UUID Versions 4, 7)Verified Primary SourceTechnical Claim Supported:
Defines 128-bit UUID generation formats, replacing RFC 4122 and standardizing Version 4 (random) and Version 7 (Unix epoch time-ordered) identifiers.
Source URI: https://datatracker.ietf.org/doc/html/rfc9562
Ecossistema Técnico Relacionado e Próximos Passos
Ferramentas Relacionadas
Guias Técnicos Relacionados
Artigos Técnicos Relacionados
What Is HTTP (Hypertext Transfer Protocol)?
Foundational stateless request-response protocol of the World Wide Web.
HTTP/1.1 vs HTTP/2: Multiplexing & Performance
Head-of-line blocking compared to binary framing and stream multiplexing.
Troubleshooting: HTTP 403 Forbidden Error
Diagnose server authorization denial, WAF IP blocks, and permission issues.
Perguntas Relacionadas
Why Is POST Non-Idempotent While PUT Is Idempotent?
Answer: PUT replaces or creates a specific resource deterministically, while POST processes input according to server logic, typically creating new items on repeated requests.
What Is the Difference Between ETag and Last-Modified?
Answer: Last-Modified relies on 1-second filesystem timestamps, while ETag provides an exact cryptographic digest of content, eliminating false positive cache misses.
Can HTTP/2 Multiplex Requests Over a Single TCP Connection?
Answer: Yes, HTTP/2 breaks requests into binary frames with stream IDs, allowing interleaved requests and responses concurrently over one TCP socket.
Laboratórios Práticos de Diagnóstico
Continuar Aprendendo
HTTP Protocol & Header Inspection Lab
Craft raw HTTP headers and observe conditional 304 responses in the interactive workbench.