Instead of SERIAL or AUTO_INCREMENT , modern distributed databases (like CockroachDB, YugabyteDB, or even PostgreSQL with an extension) use UUIDv4 as primary keys. Each application instance can generate keys independently without asking the database for the next number. However, random UUIDs cause poor index locality (B-tree fragmentation), so many now prefer (time-ordered).