In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "how to deal with id primary key after database and table division". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
Because if we divide into multiple tables, each table is accumulated from 1, which is incorrect, we need a globally unique id to support it.
There are several ways to generate a global id:
UUID: Not suitable as a primary key, because it is too long, and unreadable, query efficiency is low. An identifier suitable for generating unique names such as file names.
Database self-increment id : Two databases are set with different step sizes to generate a policy of non-duplicate ID to achieve high availability. The IDs generated in this way are ordered, but the database instances need to be deployed independently, which is costly and has performance bottlenecks.
Using redis to generate id : performance is better, flexible and convenient, does not depend on the database. However, the introduction of new components results in more complex systems, reduced availability, more complex coding, and increased system costs.
Leaf distributed ID generation system of Meituan: Leaf is a distributed ID generator of Meituan open source, which can guarantee global uniqueness, trend increment, monotonic increment and information security. It also mentions the comparison of several distributed schemes, but it also needs middleware such as dependency database and Zookeeper.
"How to deal with id primary key after sub-database and sub-table" is introduced here. Thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.