创建两个数据表:一个MyISAM 一个InnoDB;
查询数据表状态SQL命令:
show table status from think
写一个函数过程 分别在MyISAM 和InnoDB数据库存20条数据 对比速度
BEGIN
#Routine body goes here...
SET @num=1;
WHILE @num<20 DO
if t=1 then
INSERT INTO user_sys (user_name,user_pwd) VALUES(CONCAT('user',@num),'123');
else
INSERT INTO user_sys2 (user_name,user_pwd) VALUES(CONCAT('user',@num),'123');
end if;
set @num=@num+1;
END WHILE;
END
保存为 initdb 传入参数 IN t int
事务调用命令: call initdb(1);
结果如下:
MyISAM:
[SQL]call initdb(1)
受影响的行: 0
时间: 0.002s
受影响的行: 0
时间: 0.002s
InnoDB:
[SQL]call initdb(2)
受影响的行: 0
时间: 0.911s
受影响的行: 0
时间: 0.911s
可见 MyISAM 速度比 InnoDB快的多。
select * from tableName;
[SQL]select * from user_sys;
受影响的行: 0
时间: 0.000s
[SQL]
select * from user_sys2;
受影响的行: 0
时间: 0.000s
受影响的行: 0
时间: 0.000s
[SQL]
select * from user_sys2;
受影响的行: 0
时间: 0.000s
目前看不出来有什么变化
总结:
调用函数:call 函数名
查询表状态: show table status from tableName;
MyISAM 在 插入表的时候比 InnoDB快的多 !
就酱.~
1182

被折叠的 条评论
为什么被折叠?



