Rumah >pangkalan data >tutorial mysql >MySQL MyISAM的引擎和InnoDB引擎的比较

MySQL MyISAM的引擎和InnoDB引擎的比较

WBOY
WBOYasal
2016-06-07 16:09:291248semak imbas

以下的文章主要介绍的是MySQL MyISAM的引擎和InnoDB引擎的实际性能的比较,我们首先是通过MySQL数据库的表结构来引出MySQL MyISAM的引擎和InnoDB引擎的实际性能的实际操作。 CREATETABLE`myisam`( `id`int(11)NOTNULLauto_increment, `name`varchar(100)defa

以下的文章主要介绍的是MySQL MyISAM的引擎和InnoDB引擎的实际性能的比较,我们首先是通过MySQL数据库的表结构来引出MySQL MyISAM的引擎和InnoDB引擎的实际性能的实际操作。

<ol class="dp-xml">
<li class="alt"><span><span>CREATE TABLE `myisam` (  </span></span></li>
<li><span>`id` int(11) NOT NULL auto_increment,  </span></li>
<li class="alt"><span>`name` varchar(100) default NULL,  </span></li>
<li><span>`content` text,  </span></li>
<li class="alt"><span>PRIMARY KEY (`id`)  </span></li>
<li>
<span>) </span><span class="attribute">ENGINE</span><span>=</span><span class="attribute-value">MyISAM</span><span> DEFAULT </span><span class="attribute">CHARSET</span><span>=</span><span class="attribute-value">gbk</span><span>;  </span>
</li>
<li class="alt"><span>CREATE TABLE `innodb` (  </span></li>
<li><span>`id` int(11) NOT NULL auto_increment,  </span></li>
<li class="alt"><span>`name` varchar(100) default NULL,  </span></li>
<li><span>`content` text,  </span></li>
<li class="alt"><span>PRIMARY KEY (`id`)  </span></li>
<li>
<span>) </span><span class="attribute">ENGINE</span><span>=</span><span class="attribute-value">InnoDB</span><span> DEFAULT </span><span class="attribute">CHARSET</span><span>=</span><span class="attribute-value">gbk</span><span>;  </span>
</li>
</ol>

数据内容:

<ol class="dp-xml"><li class="alt"><span><span>$</span><span class="attribute">name</span><span> = “heiyeluren”; </span></span></li></ol>

$content = “MySQL支持数个存储引擎作为对不同表的类型的处理器。MySQL存储引擎包括处理事务安全表的引擎和处理非事务安全表的引擎:· MyISAM管理非事务表。它提供高速存储和检索,以及全文搜索能力。MySQL MyISAM在所有MySQL配置里被支持,它是默认的存储引擎,除非你配置MySQL默认使用另外一个引擎。 ·

MEMORY存储引擎提供“内存中”表。MERGE存储引擎允许集合将被处理同样的MyISAM表作为一个单独的表。就像MySQL MyISAM一样,MEMORY和MERGE存储引擎处理非事务表,这两个引擎也都被默认包含在MySQL中。

释:MEMORY存储引擎正式地被确定为HEAP引擎。· InnoDB和BDB存储引擎提供事务安全表。BDB被包含在为支持它的操作系统发布的MySQL-Max二进制分发版里。InnoDB也默认被包括在所有MySQL 5.1二进制分发版里,你可以按照喜好通过配置MySQL来允许或禁止任一引擎。·EXAMPLE存储引擎是一个“存根”引擎,它不做什么。你可以用这个引擎创建表,但没有数据被存储于其中或从其中检索。这个引擎的目的是服务,在MySQL源代码中的一个例子,它演示说明如何开始编写新存储引擎。同样,它的主要兴趣是对开发者。”;

[插入数据-1] (innodb_flush_log_at_trx_commit=1)
MyISAM 1W:3/s

nnoDB 1W:219/s

MyISAM 10W:29/s

nnoDB 10W:2092/s

MySQL MyISAM 100W:287/s

InnoDB 100W:

没敢测试

[插入数据-2] (innodb_flush_log_at_trx_commit=0)
 

<ol class="dp-xml">
<li class="alt"><span><span>MyISAM 1W:3/s  </span></span></li>
<li><span>InnoDB 1W:3/s  </span></li>
<li class="alt"><span>MyISAM 10W:30/s  </span></li>
<li><span>InnoDB 10W:29/s  </span></li>
<li class="alt"><span>MyISAM 100W:273/s  </span></li>
<li><span>InnoDB 100W:423/s  </span></li>
</ol>

[插入数据3] (innodb_buffer_pool_size=1024M)
 

<ol class="dp-xml">
<li class="alt"><span><span>InnoDB 1W:3/s  </span></span></li>
<li><span>InnoDB 10W:33/s  </span></li>
<li class="alt"><span>InnoDB 100W:607/s </span></li>
</ol>

[插入数据4] (innodb_buffer_pool_size=256M, innodb_flush_log_at_trx_commit=1, set autocommit=0)

<ol class="dp-xml">
<li class="alt"><span><span>InnoDB 1W:3/s  </span></span></li>
<li><span>InnoDB 10W:26/s  </span></li>
<li class="alt"><span>InnoDB 100W:379/s </span></li>
</ol>

[MySQL 配置文件] (缺省配置)

<ol class="dp-xml">
<li class="alt"><span><span># MySQL Server Instance Configuration File  </span></span></li>
<li><span>[client]  </span></li>
<li class="alt">
<span class="attribute">port</span><span>=</span><span class="attribute-value">3306</span><span> </span>
</li>
<li><span>[mysql]  </span></li>
<li class="alt">
<span class="attribute">default-character-set</span><span>=</span><span class="attribute-value">gbk</span><span> </span>
</li>
<li><span>[mysqld]  </span></li>
<li class="alt">
<span class="attribute">port</span><span>=</span><span class="attribute-value">3306</span><span> </span>
</li>
<li>
<span class="attribute">basedir</span><span>=”C:/mysql50/”  </span>
</li>
<li class="alt">
<span class="attribute">datadir</span><span>=”C:/mysql50/Data/”  </span>
</li>
<li>
<span class="attribute">default-character-set</span><span>=</span><span class="attribute-value">gbk</span><span> </span>
</li>
<li class="alt">
<span class="attribute">default-storage-engine</span><span>=</span><span class="attribute-value">INNODB</span><span> </span>
</li>
<li>
<span class="attribute">sql-mode</span><span>=”STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”  </span>
</li>
<li class="alt">
<span class="attribute">max_connections</span><span>=</span><span class="attribute-value">100</span><span> </span>
</li>
<li><span> </span></li>
<li class="alt">
<span class="attribute">query_cache_size</span><span>=</span><span class="attribute-value">0</span><span> </span>
</li>
<li>
<span class="attribute">table_cache</span><span>=</span><span class="attribute-value">256</span><span> </span>
</li>
<li class="alt">
<span class="attribute">tmp_table_size</span><span>=</span><span class="attribute-value">50M</span><span> </span>
</li>
<li>
<span class="attribute">thread_cache_size</span><span>=</span><span class="attribute-value">8</span><span> </span>
</li>
<li class="alt">
<span class="attribute">myisam_max_sort_file_size</span><span>=</span><span class="attribute-value">100G</span><span> </span>
</li>
<li>
<span class="attribute">myisam_max_extra_sort_file_size</span><span>=</span><span class="attribute-value">100G</span><span> </span>
</li>
<li class="alt">
<span class="attribute">myisam_sort_buffer_size</span><span>=</span><span class="attribute-value">100M</span><span> </span>
</li>
<li>
<span class="attribute">key_buffer_size</span><span>=</span><span class="attribute-value">82M</span><span> </span>
</li>
<li class="alt">
<span class="attribute">read_buffer_size</span><span>=</span><span class="attribute-value">64K</span><span> </span>
</li>
<li>
<span class="attribute">read_rnd_buffer_size</span><span>=</span><span class="attribute-value">256K</span><span> </span>
</li>
<li class="alt">
<span class="attribute">sort_buffer_size</span><span>=</span><span class="attribute-value">256K</span><span> </span>
</li>
<li>
<span class="attribute">innodb_additional_mem_pool_size</span><span>=</span><span class="attribute-value">4M</span><span> </span>
</li>
<li class="alt">
<span class="attribute">innodb_flush_log_at_trx_commit</span><span>=</span><span class="attribute-value">1</span><span> </span>
</li>
<li>
<span class="attribute">innodb_log_buffer_size</span><span>=</span><span class="attribute-value">2M</span><span> </span>
</li>
<li class="alt">
<span class="attribute">innodb_buffer_pool_size</span><span>=</span><span class="attribute-value">159M</span><span> </span>
</li>
<li>
<span class="attribute">innodb_log_file_size</span><span>=</span><span class="attribute-value">80M</span><span> </span>
</li>
<li class="alt"><span>innodb_thread_concurr  </span></li>
</ol>

以上的相关内容就是对MySQL MyISAM的介绍,望你能有所收获。


Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn