less than 1 minute read

/* 1만 */
DELIMITER $$
<br></br>
DROP PROCEDURE IF EXISTS TEST_INSERT_DATA$$
<br></br>
CREATE TABLE `t_contents` (
  `c_no` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `c_title` varchar(100) DEFAULT NULL,
  `c_text` text,
  PRIMARY KEY (`c_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

<br></br>
CREATE PROCEDURE TEST_INSERT_DATA()
<br></br>
BEGIN
<br></br>
	DECLARE i INT DEFAULT 1;
	WHILE i <= 10000 DO
	INSERT INTO `t_contents` VALUE(NULL,CONCAT(DATE_FORMAT(NOW(), "%Y %c/%e %r"),'_',RAND()*899999999+100000000),CONCAT(DATE_FORMAT(NOW(), "%Y %c/%e %r"),'_',RAND()*899999999+100000000,'_',RAND()*899999999+100000000,'_',RAND()*899999999+100000000));
	SET i = i + 1;
	END WHILE;
END$$
DELIMITER $$
<br></br>
CALL TEST_INSERT_DATA();
<br></br>
/* 5만 */
<br></br>
CREATE TABLE `t_tags` (
  `t_no` int(10) unsigned DEFAULT NULL,
  `c_no` int(10) unsigned DEFAULT NULL,
  `t_tag` varchar(100) DEFAULT NULL,
  KEY `t_no` (`t_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

<br></br><br></br>
DELIMITER $$
<br></br>
DROP PROCEDURE IF EXISTS TEST_INSERT_TAGS$$
<br></br>
CREATE PROCEDURE TEST_INSERT_DATA()
<br></br>
BEGIN
<br></br>
	DECLARE i INT DEFAULT 1;
	WHILE i <= 50000 DO
	INSERT INTO `t_tags` VALUE(NULL,RAND()*10000,CONCAT('tag_',RAND()*100));
	SET i = i + 1;
	END WHILE;
END$$
DELIMITER $$
<br></br>
CALL TEST_INSERT_TAGS();

<br></br>- - - - - -

루프 1만번, 5만번


🔗original-link

Updated: