UUID Primary Keys in PostgreSQL, MySQL, and MongoDB: Performance Differences and Implementation Patterns
PostgreSQL stores UUIDs as 16-byte native types with no performance penalty. MySQL's InnoDB clustered index makes random UUID v4 fragmentation far worse than in PostgreSQL. MongoDB's ObjectId is 12 bytes with an embedded timestamp. Here's how UUID primary keys actually behave in each database and the ORM patterns to use them correctly.