mysql>CREATE TABLE t1( id int primary key auto_increment, uname varchar(20) , ucreatetime datetime , age int(11)) DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci; 执行成功,花费 4 ms. mysql>delimiter $$ sql分隔符设置为[$$] mysql>create procedure test1() begin
declare v_cnt decimal (10) default 0 ; start transaction; dd:loop insert into t1 values (null,'用户1','2010-01-01 00:00:00',20), (null,'用户2','2010-01-01 00:00:00',20), (null,'用户3','2010-01-01 00:00:00',20), (null,'用户4','2010-01-01 00:00:00',20), (null,'用户5','2011-01-01 00:00:00',20), (null,'用户6','2011-01-01 00:00:00',20), (null,'用户7','2011-01-01 00:00:00',20), (null,'用户8','2012-01-01 00:00:00',20), (null,'用户9','2012-01-01 00:00:00',20), (null,'用户0','2012-01-01 00:00:00',20) ; set v_cnt = v_cnt+10 ; if v_cnt = 1000 then leave dd; end if; end loop dd ; commit; end; 执行成功,花费 1 ms. mysql>delimiter ; sql分隔符设置为[;] mysql>call test1(); 执行成功,花费 9 ms.
mysql>select * from t1 limit 2; +--------------+-----------------+-----------------------+---------------+ | id | uname | ucreatetime | age | +--------------+-----------------+-----------------------+---------------+ | 1 | 用户1 | 2010-01-01 00:00:00 | 20 | | 2 | 用户2 | 2010-01-01 00:00:00 | 20 | +--------------+-----------------+-----------------------+---------------+ 共返回 2 行记录,花费 1 ms. mysql>show variables like 'gtid%'; +-------------------------+-----------------+ | Variable_name | Value | +-------------------------+-----------------+ | gtid_executed | | | gtid_mode | ON | | gtid_next | AUTOMATIC | | gtid_owned | | | gtid_purged | | +-------------------------+-----------------+ 共返回 5 行记录,花费 1 ms.
mysql>show variables like '%sync%'; +-------------------------------------------+-----------------+ | Variable_name | Value | +-------------------------------------------+-----------------+ | innodb_sync_array_size | 1 | | innodb_sync_spin_loops | 100 | | rds_rpl_consistency_sync_enabled | OFF | | rpl_semi_sync_master_enabled | ON | | rpl_semi_sync_master_timeout | 1000 | | rpl_semi_sync_master_trace_level | 1 | | rpl_semi_sync_master_wait_for_slave_count | 1 | | rpl_semi_sync_master_wait_no_slave | ON | | rpl_semi_sync_master_wait_point | after_commit | | rpl_semi_sync_slave_delay_master | OFF | | rpl_semi_sync_slave_enabled | OFF | | rpl_semi_sync_slave_kill_conn_timeout | 5 | | rpl_semi_sync_slave_trace_level | 1 | | sync_binlog | 1 | | sync_frm | ON | | sync_master_info | 10000 | | sync_relay_log | 10000 | | sync_relay_log_info | 10000 | | tokudb_commit_sync | ON | | tokudb_fsync_log_period | 0 | +-------------------------------------------+-----------------+ 共返回 20 行记录,花费 1 ms.
mysql>show master status\G; *************************** 1. row *************************** File: mysql-bin.000004 Position: 4197491 Binlog_Do_DB: Binlog_Ignore_DB: Executed_Gtid_Set: 905e45fd-82fb-11e7-ae4e-7cd30abc989e:1-6953 共返回 1 行记录,花费 1 ms.
mysql>show variables like 'server%'; +-------------------------+--------------------------------------+ | Variable_name | Value | +-------------------------+--------------------------------------+ | server_id | 1516718431 | | server_id_bits | 32 | | server_uuid | 905e45fd-82fb-11e7-ae4e-7cd30abc989e | +-------------------------+--------------------------------------+ 共返回 3 行记录,花费 1 ms. mysql>show variables like 'lower%'; +-------------------------+-----------------+ | Variable_name | Value | +-------------------------+-----------------+ | lower_case_file_system | OFF | | lower_case_table_names | 1 | +-------------------------+-----------------+ 共返回 2 行记录,花费 9 ms.
|