top of page
Search
Writer's pictureLeonard Anghel

The Best Way To Manually Assign UUID Identifiers

Updated: May 10, 2020

Motivation:

Commonly, UUID are used in clustered environment, where numerical primary keys are prone to conflicts. But, for avoiding conflicts in clustered environments, most relational databases relies on numerical sequences. In other words, each node from the cluster has its own offset used for generating identifiers. Alternatively, but not better, is to use UUID primary keys. But, UUID comes with performance penalties in clustered indexes because their lack of sequentiality and have a bigger memory footprint too. Nevertheless, if you decide to use UUID and assign them manually then here it i how.


150+ PERSISTENCE PERFORMANCE ITEMS

THAT WILL ROCK YOUR APPS


Description:

This application is an example of manually assigning UUID identifiers.

Key points:

  • Store UUID in a BINARY(16) column:

  • Manually assign the UUID value (for example, via UUID.randomUUID() ):

Testing time:

Check as well:


Tam Ta Da Dam! :) The complete application is available on GitHub.

If you need a deep dive into the performance recipes exposed in this repository then I am sure that you will love my book "Spring Boot Persistence Best Practices".



347 views0 comments

Recent Posts

See All

How To Bulk Updates

Motivation: This article is useful if you need a fast way to update a significant amount of data in the database. Bulk operations...

Comments


bottom of page