I know it seems like a good idea, but unless you have an extremely trivial amount of data, this is almost always bad. In my experience it's best to just have a serial bigint for internal database relations and then have a unique uuid field for application-level identifiers and natural keys. Then PG doesn't have to copy that humongous 128bit int to every side of the relation. Imagine you have 1 billion rows...32 gigabytes just for table storage + PK index. Yikes. Misery.
https://github.com/launchbadge/realworld-axum-sqlx/blob/main/migrations/2_user.sql#L14
I know it seems like a good idea, but unless you have an extremely trivial amount of data, this is almost always bad. In my experience it's best to just have a serial bigint for internal database relations and then have a unique uuid field for application-level identifiers and natural keys. Then PG doesn't have to copy that humongous 128bit int to every side of the relation. Imagine you have 1 billion rows...32 gigabytes just for table storage + PK index. Yikes. Misery.