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

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

DROP PROCEDURE LoopDemo;
 
DELIMITER $$
CREATE PROCEDURE LoopDemo()
BEGIN
    DECLARE x  INT;
        
    SET x = 1;
        
    loop_label:  LOOP
        IF  x > 10000000 THEN 
            LEAVE  loop_label;
        END  IF;
            
        SET  x = x + 1;

        insert into test_id (name) values ('Reading table information for completion of table and column names');
        insert into test_id2 (name) values ('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 (17.47 sec)

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


-- insert: 10_000_000
-- Query OK, 1 row affected (7 min 26.66 sec)


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


-- time echo "use test_uuid; select * from test_id" | sudo mysql >/dev/null
-- real	0m11.006s
-- user	0m5.911s
-- sys	0m0.564s
