Best (most efficient) DataType to use for UUIDs in the form of JPA identifiers

I want to use UUIDs as identifiers for my JPA objects.

I am currently just using String to store UUIDs. What would be more effective?

+3
source share
1 answer

How do you measure effectiveness?

For example, saving UUIDs (which is text encoding byte[]) as a pair of values longwill allow you to quickly compare them with a 64-bit architecture (much faster than a Stringcomparison, which is a typical character). However, your coding efficiency will suffer because you have to write your own type.

What is important in your case?


If you are interested in database performance, the performance will depend to some extent on the database of your choice, but everyone will essentially compare the UUID bytes. So, it is important that the differences between the keys are more likely at the beginning of the key.

UUIDs . UUID - "" . , , , . " " UUID , ( ) , ( UUID) .

+5

Source: https://habr.com/ru/post/1706126/


All Articles