Choosing a Postgres primary key
My opinion. Always if in any way possible pick a semantic key. There is usually something defining the thing you are working on. If there isnt work on your normalisation.Main benefits to this:
Avoids accidental duplication (happens so much). Avoids additional round trips to fetch the id to make a mutation.Of course if you work on something where you don’t know what it is yet (actually humans are a good example for that) uuid or int might make sense but I hear so many times picking non semantic as a default.