In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Today, I will talk to you about whether mysql uuid is increasing in an orderly manner. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.
A UUID is designed as a number that is globally unique in space and time. Two calls to UUID () are
Expected to generate two different values, even if these calls are performed on two separate computers
That are not connected to each other.
Uuid is the only one in the world, even if two computers with no relationship uuid are different.
However, the document does not say whether it is orderly or not. It is said on the Internet that uuid is disordered. I would like to try a scene:
Scenario explanation:
Build a table with two fields, uuid and time.
Insert a piece of data into this table every second, namely uuid () and now ()
After a period of insertion, if sorting by id is the same as sorting by t_date, then you should be able to prove that uuid is ordered, and if the sorting results are not the same, then it is unordered.
I plugged in two processes here at the same time and ran for two hours.
Simulation process:
Testing on mysql 5.6
Mysql > create table song (id char (36), t_date datetime)
Query OK, 0 rows affected (0.00 sec)
Cat insert.sh
#! / bin/bash
While true; do
Mysql-h20.13.52.100-P3306-uroot-ptest-e "insert into test.song select uuid (), now ();"
Sleep 1
Done
Nohup sh insert.sh &
Nohup sh insert.sh &
Insert the two together.
Run for about two hours, after stopping insert.sh:
Mysql-h20.13.52.100-P3306-uroot-ptest-e "select * from test.song order by tdatedate;" > a.log
Mysql-h20.13.52.100-P3306-uroot-ptest-e "select * from test.song order by id;" > b.log
Diff a.log b.log-y > c.log
[root@10-13-59-213] # vim c.log
Id t_date id t_date
B6af9995-50d2-11e6-9d61-5254005ae15d 2016-07-23 20:41:01 | 0019655a-50d5-11e6-9d61-5254005ae15d 2016-07-23 20:57:24
Cc161c32-50d2-11e6-9d61-5254005ae15d 2016-07-23 20:41:37 | 001968e2-50d5-11e6-9d61-5254005ae15d 2016-07-23 20:57:24
Ccafd852-50d2-11e6-9d61-5254005ae15d 2016-07-23 20:41:38 <
Cd495dc1-50d2-11e6-9d61-5254005ae15d 2016-07-23 20:41:39 <
You can see the difference between a.log and b.log in c.log. Then uuid () is unordered.
After reading the above, do you have any further understanding of whether mysql uuid is increasing in an orderly manner? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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.