E
E
EVGENY T.2018-08-14 12:24:33
Database
EVGENY T., 2018-08-14 12:24:33

Is it possible to use UUID to generate keys?

For many years I used (explicitly or implicitly) sequences and counters to generate keys (id) in database tables.
But recently I saw someone using UUID for this purpose.
How reliable is this solution? Is it possible to resort to it if there are no regular sequences / counters at hand?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2018-08-14
@Beshere

How reliable is this solution?
As much as any other. What aspect of "reliability" are you interested in, what do you mean by this word?
Is it possible to resort to it if there are no regular sequences / counters at hand?
You can even resort to having them.
UUID is well suited for distributed systems and generating an identifier on the client - when it is not possible to use the database as a single source of truth.
It also allows you to hide data about the system - how many users register per day, how many orders are placed, etc. If a monotonically increasing counter is used, it is easy to get some insights about someone else's business ( German tank problem ).
For developers with not very direct hands, it can act as an analogue of authorization and protect the numbers in the address bar from being changed by the same crooked pentester. But you don’t need to rely on the complexity of selection in terms of authorization, you need to immediately do normal protection.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question