Concretely, when should I use one type of ID rather than another ?
Between :
UNIQUEID()
UNIQUEID("UUID")
UNIQUEID("PackedUUID")
Solved! Go to Solution.
UNIQUEID() (with no argument) generates a sequence of 8 random digits and letters suitable for use as a unique identifier within the app, such as a row key. The generated ID is not strictly unique. Instead, it is sufficiently random as to be effectively unique for all practical uses within the app. The chance of a duplicate ID being generated is virtually zero.
UNIQUEID("UUID") generates a version 4 universally-unique identifier (UUID), a sequence of random digits and letters suitable for use as a unique identifier. While the generated ID is not guaranteed to be unique, it is sufficiently random as to be effectively unique for all purposes.
UNIQUEID("PackedUUID") generates a sequence of 22 random digits, letters, hyphens, and underscores suitable for use as a unique identifier. While the generated ID is not guaranteed to be unique, it is sufficiently random as to be effectively unique for all purposes.
Yes, that's what the AppSheet help says, but it doesn't concretely say when to use one system rather than another. The last sentences of each definition seem to mean the same thing in a different way.
UNIQUEID()
expression:
UNIQUEID()
is generating an 8 HEX characters key, it has some probability of being duplicated, although quite small.UNIQUEID("UUID")
is generating an 32 HEX characters key, it's way less possible to have a duplicated key. This is also a standard in some systems and it's the reason I use it with my Supabase Postgres databases.UNIQUEID("PackedUUID")
has less characters than the previous one, is has more probability of being duplicated, although quite small compared to the first option.Finally, you could create any other expression for keys since the main purpose is to be unique. You could add some text before or after a UNIQUEID()
expression, make it uppercase or lowercase, add two UNIQUEID()
together, etc... all with expressions like CONCATENATE()
Thank you for the clarification.
Should I conclude that all my IDs should be UNIQUEID("UUID") for more security if I plan to make an app with lots of rows?
Could creating an ID with this expression make sense: UNIQUEID()&UNIQUEID() ?
User | Count |
---|---|
18 | |
14 | |
11 | |
7 | |
4 |