In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
In this issue, the editor will bring you about how to create tens of millions of stress test data according to the table in MySQL. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
1. Prepare the test table
CREATE TABLE `username` (`uid` INT (11) UNSIGNED NOT NULL default 1235678901, `username` VARCHAR (20), `email` VARCHAR (30), `password` VARCHAR (32), `day` date, `gender` VARCHAR (10), avatar MEDIUMBLOB, PRIMARY KEY (`uid`) ENGINE = INNODB DEFAULT CHARSET=utf8
two。 Randomly generated data
MySQL comes with a random number generated function RAND (), which can generate 0-1 floating point numbers.
The RAND function generates random numbers:
SET GLOBAL log_bin_trust_function_creators = 1
CREATE DEFINER = `root` @ `% `FUNCTION `root` rand_ string` (n INT) RETURNS VARCHAR
DECLARE
Chars_str VARCHAR DEFAULT 'hwbtestABCDEFG23141HIJ6712dfghjkqwevbnqmwerqwerqwreqw214123e1214c12dssaf89'
DECLARE
Return_str VARCHAR (255) DEFAULT''
DECLARE
I INT DEFAULT 0
WHILE
I < n DO
SET return_str = concat (return_str, substring (chars_str, FLOOR (1 + RAND () * 80), 1))
SET ii = I + 1
END WHILE
RETURN return_str
END
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
Select ISNULL (sum (field), 0) from tableName
© 2024 shulou.com SLNews company. All rights reserved.