Home > Database > Mysql Tutorial > body text

archive存储引擎注意事项

WBOY
Release: 2016-06-07 17:37:09
Original
1151 people have browsed it

我这有个业务,专门存储LOG日志的,每天都会有上千万数据,所以采用了archive存储引擎,这样写入上较快,也比较节省空间。archive存储引擎这里简单介绍下:这个

我这有个业务,专门存储LOG日志的,每天都会有上千万数据,所以采用了archive存储引擎,这样写入上较快,也比较节省空间。


archive存储引擎这里简单介绍下:

171318173.jpg


这个可以说和MyISAM引擎差不多,备份的时候直接cp拷贝数据文件,恢复时直接cp拷贝到MySQL数据目录,而且在空间上节省了不少,下面来看看。


171737478.jpg

171925628.jpg


通过物理文件,,可以明显的对比出来。


看看磁盘IO性能图

181015247.jpg

压力有所变小。


好,下面说一个注意事项。今天开发反馈一条很简单的范围查询,结果耗时1分多钟,我查看了下查询字段是主键,不应该这么慢,如图:


172223343.jpg


结果全表扫描了。会不会是archive特性决定的?于是转换为MyISAM引擎,再试试:


172449827.jpg


很明显的看出,MyISAM引擎在范围搜索时,是可以利用到索引的,而archive引擎会全表扫描。


如果是=,in,archive引擎均可以用到索引。


174929950.jpg


174929656.jpg


本文出自 “贺春旸的技术专栏” 博客,请务必保留此出处

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!