我有一个包含静态表的数据库,需要每周从 CSV 更新.表是 Mysql MyISAM,静态我的意思是它们仅用于只读(显然,从 CVS 更新时除外).
每周有大约 50 个表和总共大约 200MB 的数据需要重新加载.
我可以考虑 3 种方法:
或
或
你认为最有效的方法是什么?
解决方案我更喜欢第 3 种方法,也保留旧表.
这种方法的优点是快速、安全,对读者的影响较小.新表的创建不会影响对现有表的读取.重命名操作更快(在 myisam 的情况下只是文件重命名),因此停机时间并不多.所以客户不会受到太大的影响.您还必须保留旧数据,以防新数据出现问题.
由于您不打算在线更新它,我认为如果您使用 myisampack 会很好.
I have a database with static tables which require to be updated from CSV weekly. Tables are Mysql MyISAM and by static i mean they are used for read only (except when updated from CVS, obviously).
There're about 50 tables and in total about 200mb of data to be reloaded weekly.
I can think about 3 ways:
Or
Or
What do you reckon is the most efficient way?
解决方案I would prefer the 3rd method and also keep the old table.
The advantage of this method is that it fast and safe with less effect on the readers. The creation of new table does not affect reads on existing table. The rename operation is faster (just a file rename in case of myisam) so the downtime is not that much. So the clients will not be affected by this that much. You also got to keep the old data in case something is wrong with the new data.
As you are not going to update it online I think it will be good if you do myisampack.
更多推荐
定期将数据加载到表中的最佳方法是什么
发布评论