[英]Choice of MySQL table type for non-critical webapp data (MyISAM vs. InnoDB)
Consider this scenario with the following assumptions: 考虑这种情况,假设如下:
Pros of MyISAM under said assumptions: 在所述假设下MyISAM的优点:
All-in-all I'm very happy with MyISAM with one major exception. 总而言之,我对MyISAM非常满意,但有一个例外。 MyISAM has one major shortcoming under said assumptions and that is table level locking.
在所述假设下,MyISAM有一个主要缺点,即表级锁定。 When UPDATEs are running towards a frequently read table all reads are blocked.
当UPDATE向经常读取的表运行时,所有读取都被阻止。 Needless to say this causes major performance problems which must be solved.
不用说,这会导致必须解决的主要性能问题。
My questions are: 我的问题是:
innodb_file_per_table
option. innodb_file_per_table
选项让它“更像”。 InnoDB will still store critical information in its system-level data file, however, and you can't do things like casually rename a database by renaming the directory it lives in like you can with MyISAM. Have you actually taken performance metrics using myisam and innodb tables? 您是否真的使用myisam和innodb表获取了性能指标? In my experience the differences in speed is not really that much when you consider all the ACID benefits you get from innodb.
根据我的经验,当你考虑从innodb获得的所有ACID好处时,速度上的差异并不是那么多。 Just the table locking alone will affect speed such that innodb would be overall faster.
只是单独锁定表会影响速度,因此innodb总体上会更快。
Also notice that myisam is much faster on inserts, not so much on selects. 另请注意,myisam在插入时要快得多,而不是选择。 You are inserting only 5% of the time... do the math.
你只插入5%的时间...做数学。
You can always do mysqldump using an innodb, so your backup rocess is the same. 你总是可以使用innodb做mysqldump,所以你的备份过程是一样的。
I know some projects use a mirror DB for searching. 我知道有些项目使用镜像DB进行搜索。 It tends to be optimized for the searches and sometimes even run on a different machine, just to isolate the overhead.
它倾向于针对搜索进行优化,有时甚至可以在不同的机器上运行,只是为了隔离开销。
The only drawback here is that keeping them in sync is a bit of a hassle. 这里唯一的缺点是保持它们同步有点麻烦。 If stale data in your search table isn't too troubling, it might be the best bet.
如果搜索表中的陈旧数据不是太麻烦,那么它可能是最好的选择。 If performance is an issue that is.
如果性能是一个问题。
It isn't my favorite solution, but it is pretty simple in theory. 这不是我最喜欢的解决方案,但理论上它非常简单。
In other words I think you should definitely give InnoDB a try and benchmark the performance of your application. 换句话说,我认为你一定要试试InnoDB并对应用程序的性能进行基准测试。 Migration is extremely simple, so I don't see a reason not to try.
迁移非常简单,所以我没有理由不去尝试。 For me InnoDB is a default choice for a long time.
对我来说,InnoDB很长一段时间都是默认选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.