Developers often default to using UUIDs as primary keys in their databases, but when it comes to SQLite, this choice can significantly degrade performance.
Sequential integers — such as auto-incrementing row IDs — offer far better performance in SQLite due to the way the B-tree index structure works. UUIDs are random and large, causing index fragmentation and slower inserts. SQLite's built-in rowid is efficient, compact, and fast.
If you need a public identifier for security or distribution, keep the UUID as a separate column with a unique constraint, but use a plain integer as the primary key internally. This hybrid approach gives you the best of both worlds: fast joins and indexing with the integer key, and safe external references with the UUID.
In summary: use sequential integers for primary keys in SQLite and reserve UUIDs solely for public-facing identifiers.