C
C#2y ago
Pokey

EF Primary Key - int, uint, long or ulong?

I want to hold lots and lots of rows in my Postgres database. I assume I would be best advised configuring my entities and migrations to use a ulong as the Primary Key?
8 Replies
Monsieur Wholesome
if you can store 18_446_744_073_709_551_615; Or in words: eighteen quintillion four hundred forty-six quadrillion seven hundred forty-four trillion seventy-three billion seven hundred nine million five hundred fifty-one thousand six hundred fifteen; elements in your database, sure go for it But I'd reckon 2 Billion (int32) would also do the trick Also mind, something like unsigned integers are special and not many languages have them; Java (doesnt integrate nicely), PHP, JavaScript for example dont have them
Pokey
Pokey2y ago
ew really
Monsieur Wholesome
Which limits your db to only be used by C# in practice, which ehhh
Pokey
Pokey2y ago
I already use ulong in other places so that ship has sailed
Monsieur Wholesome
lol iirc, discord's snowflakes fit into ulong's, but they're shipped as strings in json; Cuz many languages couldnt deserialize them
Pokey
Pokey2y ago
ulong it is then I guess xD
Pokey
Pokey2y ago
Thanks for the input