I usually make an auto-increment id field as pk in...
# android
a
I usually make an auto-increment id field as pk in my tables but I am not sure if this is a good practice and maybe it would be better to use UUIDs that I generate before inserting. I see advantages of
UUID
in cases where I need the pk
id
for a sequential operation (insert and then do insert in another table with the id). The id does get return by
Insert
anyway so this is not a real problem. However, for instance if I have json that I want to insert, having autogenerated pk does not allow an easy way to add User and UserRoles. In json if I have the uuids generated then I can insert whatever info I want. On the downsize uuids need to be handled (generated before insert) and also are taking way more space than long. Any thoughts on this?