Skip to content

[BE] 부하테스트용 dummy data INSERT

xrabcde edited this page Oct 15, 2021 · 4 revisions

상황에 맞게 변수를 변경해서 사용하시면 됩니다!

member

DELIMITER $$
DROP procedure IF EXISTS loopInsert$$

create procedure loopInsert()
begin
    declare i int default 1;
    while i <= 10000 do
        INSERT INTO `zzimkkong`.`member`(`email`,`password`, `organization`)
        VALUES(CONCAT(CONVERT(i, CHAR), '@test.com'), '$2a$10$rVfh3VGeIAAEuYum/ECtSeFRqvxzMO0HXIYAYWinJWDy9xydwOG3C', 'test');
        set i = i + 1;
    end while;
end$$
DELIMITER $$

call loopInsert;

map

DELIMITER $$
DROP procedure IF EXISTS loopInsert$$

create procedure loopInsert()
begin
    declare i int default 1;
    while i <= 100000 do
        INSERT INTO `zzimkkong`.`map`(`map_drawing`,`map_image_url`, `name`, `member_id`)
        VALUES('{"width":800,"height":600,"mapElements":[{"id":2,"type":"polyline","stroke":"#333333","points":["100,100","700,100"]},{"id":3,"type":"polyline","stroke":"#333333","points":["700,100","700,500"]},{"id":4,"type":"polyline","stroke":"#333333","points":["700,500","100,500"]},{"id":5,"type":"polyline","stroke":"#333333","points":["100,500","100,140"]},{"id":6,"type":"polyline","stroke":"#333333","points":["100,140","400,140"]},{"id":7,"type":"polyline","stroke":"#333333","points":["400,180","300,180"]},{"id":8,"type":"polyline","stroke":"#333333","points":["300,180","300,500"]},{"id":9,"type":"polyline","stroke":"#333333","points":["260,140","260,260"]},{"id":10,"type":"polyline","stroke":"#333333","points":["260,300","100,300"]},{"id":11,"type":"polyline","stroke":"#333333","points":["260,300","260,360"]},{"id":12,"type":"polyline","stroke":"#333333","points":["260,400","100,400"]},{"id":13,"type":"polyline","stroke":"#333333","points":["260,400","260,460"]},{"id":14,"type":"polyline","stroke":"#333333","points":["300,400","460,400"]},{"id":15,"type":"polyline","stroke":"#333333","points":["500,400","500,500"]},{"id":16,"type":"polyline","stroke":"#333333","points":["500,400","660,400"]},{"id":17,"type":"polyline","stroke":"#333333","points":["400,180","400,360"]},{"id":18,"type":"polyline","stroke":"#333333","points":["440,360","660,360"]},{"id":19,"type":"polyline","stroke":"#333333","points":["660,360","660,140"]},{"id":20,"type":"polyline","stroke":"#333333","points":["660,140","440,140"]},{"id":21,"type":"polyline","stroke":"#333333","points":["440,140","440,320"]},{"id":22,"type":"rect","stroke":"#333333","width":100,"height":60,"x":100,"y":20,"points":["100, 20","200, 80"]}]}',
        'https://d1dgzmdd5f1fx6.cloudfront.net/thumbnails/4.png', 'bada', '13');
        set i = i + 1;
    end while;
end$$
DELIMITER $$

call loopInsert;

space

use zzimkkong;

DELIMITER $$
DROP procedure IF EXISTS loopInsert$$

create procedure loopInsert()
begin
    declare i int default 61; // map_id 입니다. default value와 while loop break 값은 table 확인해서 유동적으로 바꿔주면 됩니다
    declare j int default 1; // map 당 몇개의 space를 넣을 건지
    
    while i <= 100060 do
        set j = 1;
	while j <= 100 do
		INSERT INTO `zzimkkong`.`space` (`area`, `color`, `description`, `name`, `available_end_time`, `available_start_time`, `enabled_day_of_week`, `reservation_enable`, `reservation_maximum_time_unit`, `reservation_minimum_time_unit`, `reservation_time_unit`, `map_id`)
		VALUES ('{"shape":"rect","x":350,"y":200,"width":10,"height":10}', '#FF7515', 'test', 'test', '23:00:00', '07:00:00', 'monday,tuesday,wednesday,thursday,friday,saturday,sunday', '', '1440', '10', '10', i);
		set j = j + 1;
	end while;
        set i = i + 1;
    end while;
end$$
DELIMITER $$

call loopInsert;

reservation

DELIMITER $$
DROP procedure IF EXISTS loopInsert$$

create procedure loopInsert()
begin
    declare i int default 530000; // space_id 입니다. default value와 while loop break 값은 table 확인해서 유동적으로 바꿔주면 됩니다
    declare j int default 1; // 공간당 넣고싶은 reservation 갯수 (1분 단위로 시간이 증가하면서 예약이 생성되는 로직입니다)
    while i <= 532600 do
	set j = 1;
	while j <= 200 do
		INSERT INTO `zzimkkong`.`reservation`(`description`,`date`, `end_time`, `password`, `start_time`, `user_name`, `space_id`)
			VALUES('asdf', date(date_add('2025-09-06 00:00:00', interval j minute)), date_add('2025-09-06 00:01:00', interval j minute), '1234', date_add('2025-09-06 00:00:00', interval j minute), 'asdf', i);
		set j = j + 1;
	end while;
	set i = i + 1;
    end while;
end$$
DELIMITER $$

call loopInsert;
Clone this wiki locally