In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. Uuid () function
Mysql > select uuid (), uuid () +-+-+ | uuid () | uuid () | +-- -+ | 50120c25-d75c-11e7-9484-000c29c9278a | 50120c53-d75c-11e7-9484-000c29c9278a | +-- +- -+ 1 row in set (0.00 sec) String * Item_func_uuid::val_str (String * str) {. Mac\ rand get...uint32 time_low= (uint32) (tv & 0xFFFFFFFF) Uint16 time_mid= (uint16) ((tv > > 32) & 0xFFFF); uint16 time_hi_and_version= (uint16) ((tv > 48) | UUID_VERSION); s [8] = s [13] ='-'; tohex (s, time_low, 8); tohex (swarm 9, time_mid, 4); tohex (swarm 14, time_hi_and_version, 4); strmov (swarm 18, clock_seq_and_node_str) .} detailed generation of uuid process, refer to the above function for analysis.
Time_low, time_mid and time_high_and_version correspond to paragraph 123 respectively when they are converted to hexadecimal.
This time is the 100ns value from 1582-10-1500 to the current time. (in fact, the system can only get the exact us and multiply it by 10). So if you execute continuously for a short period of time, it is more likely that only the first value is changing, in fact, 1 / 2 / 3 may change. Paragraph 4 is the random number when you execute select uuid () for the first time after you start the MySQL, which will change each time you restart. Paragraph 5 is the Mac value turned around, and multiple instances of the same machine are generally the same. If the Mac value is not available, it is a random value. So this value can be thought of as different for each execution. And there is only a very small probability of repetition between different instances.
2. Uuid_short () function
Mysql > select uuid_short (), uuid_short () +-+ | uuid_short () | uuid_short () | +-+ | 818004335832072194 | 818004335832072195 | +- -+ 1 row in set (0.00 sec) function call procedure:
Main- > init_common_variables ()-> server_start_time= flush_status_time= my_time (0); / / obtain the timestamp of server startup ulonglong uuid_value;main- > init_common_variables- > item_init- > void uuid_short_init () {uuid_value= (ulonglong) server_id))
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.