drop database database test_uuid;
create database test_uuid;
use test_uuid;
drop table test_id;
create table test_id (
  id varchar(37) not null,
  name varchar(128),
  primary key(id)
);

drop table test_id2;
create table test_id2 (
  id varchar(37) not null,
  name varchar(128),
  primary key(id)
);

DROP PROCEDURE LoopDemo;
 
DELIMITER $$
CREATE PROCEDURE LoopDemo()
BEGIN
    DECLARE x  INT;
    DECLARE uuid VARCHAR(37);
        
    SET x = 1;
        
    loop_label:  LOOP
        IF  x > 10000000 THEN 
            LEAVE  loop_label;
        END  IF;
            
        SET  x = x + 1;
        SET uuid = CONCAT((10000000 + x), "-638a-11ea-a6bb-e0d55e6863be");

        insert into test_id (id, name) values (uuid, 'Reading table information for completion of table and column names');
        insert into test_id2 (id, name) values (uuid, 'Second table information for completion of table and column names');


    END LOOP;
END$$

DELIMITER ;



CALL LoopDemo();

-- my.cfn выключен синхронный режим
-- insert: 200_000
-- Query OK, 1 row affected (10.30 sec)

-- select count(*) from test_id inner join test_id2 on test_id2.id = test_id.id;
-- +----------+
-- | count(*) |
-- +----------+
-- |   200000 |
-- +----------+
-- 1 row in set (0.19 sec)


-- insert: 10_000_000
-- Query OK, 1 row affected (9 min 10.10 sec)


-- select count(*) from test_id inner join test_id2 on test_id2.id = test_id.id;
-- +----------+
-- | count(*) |
-- +----------+
-- | 10000000 |
-- +----------+
-- 1 row in set (22.58 sec)

-- time echo "use test_uuid; select * from test_id" | sudo mysql >/dev/null
-- real	0m12.709s
-- user	0m7.919s
-- sys	0m0.639s

