Hey everyone. It's my first time using SQL so I'm...
# help
m
Hey everyone. It's my first time using SQL so I'm wondering what kind of type I should use for a row id in a table. Should I just leave it at int8?
k
int8 is good for new applications, a lot of apps still uses int4 and works OK
m
I see, thank you!
k
Using incrementing keys has some problems (you can't generate a complete row outside the DB, and just looking at ids can tell users something about your scale), but it's simple and fast.
m
Yeah thats what concerned me at the start but users knowing the scale cant be that big of a deal right ?
not much they can do with that piece of info
k
another thing is: if users can guess ids of things, and you botch securing those things, then they might be able to access something they should not
m
I also have another question. I want to implement search based on location in my app. I know that I'm supposed to get location names from another database but how do I add it into supabase ? Is it hard ?
Nah I dont think there will be such concern because the data wont be sensitive
k
I haven't worked with geonames for years, but I'm sure there are examples. Can you try asking on the channel? This question might get lost if it stays in a thread.
m
Sure, thank you for your time
s
You can see the ranges of those key types (int8, int4) here https://www.postgresql.org/docs/current/datatype-numeric.html
Here is info on the UUID type https://www.postgresql.org/docs/current/datatype-uuid.html I assume UUID is stored in 16 bytes as docs say it represents a 128 bit quantity