Mysql IO write too much -
i have table uses myisam engine on server. there 10 update statements per second on average. found mysql process disk write lot higher theoretical value. after experimenting, suspect modifying column of data rewrite entire row of data. following experiment...
my table:
create table `test_update` ( `id` int(11) not null default '0', `str1` blob, `str2` blob, `str3` blob, `update_time` int(11) default '0', primary key (`id`), key `update_time` (`update_time`) ) engine=myisam;
i inserted 100000 rows data,each row has 30k string(10k per blob).after randomly update ‘update_time’ column 1 row/sec
while 1: sql = "update test_update set update_time=%d id=%d" %(now, randomid) cur.execute(sql) conn.commit() slp_t = 1-(time.time()-end) if slp_t>0: time.sleep(slp_t) end=time.time()
and iotop shows:
https://i.stack.imgur.com/sja8y.png
it seems modifying int column rewrite entire row(even more). true? if answer yes, why designed this? should avoid waste?
Comments
Post a Comment