AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Mysql uuid vs long index performance1/17/2024 ![]() Taking the classic issue tracking/project management tool as an example. order #), inspected by the operation engineer, customer suppport etc.ĩ9.9% of the applications won't reach internet scale and they just consist of several models allowing CRUD operations, containing thousands of records. The primary key is not only used by the system, it's also exposed to the end user (e.g. Number is easy to write, easy to remember and easy to communicate. Readability, and readability leads simplicity. But based on our experience, 95% of the time, the default choice should always be Auto Increment Integer. Attackers can also scan the integer range to explore leakage (though it shouldn't happen if ACL is implemented correctly).Īs listed above, there are Pros and Cons between the 2 approaches. Some business data can be exposed, since the latest ID could represent the total number of inventory.And that service becomes a single-point-of-failure (SPOF). ![]() ![]() In a distributed system, this often means to introduce a separate service to produce this sequential number. Instead, we must consult the database to figure out the next available primary key. It can't be used in the distributed system since it's quite likely that different hosts could produce exactly the same number.If the table itself has only a few columns, the extra primary key space overhead will become more significant. ![]() For Auto Increment Integer, when stored as Long format, it occupies 8 bytes. Thinking of issue id, obviously, issue-123 is much more readable than issue-b1e92c3b-a44a-4856-9fe3-925444ac4c23. This is especially valuable if we would expose it externally. Using auto increment integer/serial as the primary key in your SQL database is also quite common and every major database engine provides the native support. On the other hand, PostgreSQL uses heap instead of clustered primary key, thus using UUID as the primary key won't impact PostgreSQL's insertion performance. This is because it requires reordering the rows to place the newly inserted row at the right position inside the clustered index.
0 Comments
Read More
Leave a Reply. |