UUID v4 vs. Auto-Incrementing IDs: Which Should You Use?

UUID v4 and auto-incrementing integers both identify records, but they make different trade-offs. UUIDs can be created independently; auto-incrementing IDs are compact and easy to inspect.
When UUID v4 is useful
UUID v4 works well when multiple clients or services must create records without waiting for a shared database sequence. It can also avoid exposing a simple record count in public URLs. Generate values with the UUID Generator.
When auto-incrementing IDs are useful
Integers use less storage, are readable in logs, and work naturally with sequential database indexes. They are often a good choice for a simple centralized application.
Important considerations
UUIDs are not a security boundary. Authorize every request regardless of the identifier format. Test indexing and storage behavior with your database before choosing an identifier strategy.
FAQ
Can I use both?
Yes. Some systems keep an internal integer key and expose a UUID externally when there is a practical reason to do so.