当前位置:Gxlcms > 数据库问题 > mysql经典案例分析

mysql经典案例分析

时间:2021-07-01 10:21:17 帮助过:26人阅读

create table t7 (
id char(64) primary key,
var int not null default 0,
str1 varchar(3000) not null,
str2 varchar(3000) not null,
str3 varchar(3000) not null,
str4 varchar(3000) not null
key `idvar` (id,var)
)engine=myisam charset=utf8;

create table t8 (
id char(64) primary key,
var int not null default 0,
str1 varchar(3000) not null,
str2 varchar(3000) not null,
str3 varchar(3000) not null,
str4 varchar(3000) not null
)engine=innodb charset=utf8;
alter table t7 add index idver(id,var)

结论: innodb 大字段(char)主键 造成大量分裂, 正好发挥的是innodb的劣势
如果没有这么长大字段的列 ,差距也不会很大
alter table t8 drop column st1;alter table t8 drop column st2;alter table t8 drop column st3;

mysql经典案例分析

标签:add   index   efault   span   覆盖   isa   为什么   案例   lte   

人气教程排行