﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-愚人博客-随笔分类-MySQL</title><link>http://www.blogjava.net/imfisher/category/25226.html</link><description /><language>zh-cn</language><lastBuildDate>Sat, 25 Aug 2007 03:55:11 GMT</lastBuildDate><pubDate>Sat, 25 Aug 2007 03:55:11 GMT</pubDate><ttl>60</ttl><item><title>[转]InnoDB与MyISAM表之间的差别</title><link>http://www.blogjava.net/imfisher/archive/2007/08/24/139156.html</link><dc:creator>愚人</dc:creator><author>愚人</author><pubDate>Fri, 24 Aug 2007 10:05:00 GMT</pubDate><guid>http://www.blogjava.net/imfisher/archive/2007/08/24/139156.html</guid><wfw:comment>http://www.blogjava.net/imfisher/comments/139156.html</wfw:comment><comments>http://www.blogjava.net/imfisher/archive/2007/08/24/139156.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/imfisher/comments/commentRss/139156.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/imfisher/services/trackbacks/139156.html</trackback:ping><description><![CDATA[<p>InnoDB和MyISAM是在使用MySQL最常用的两个表类型，各有优缺点，视具体应用而定。下面是已知的两者之间的差别，仅供参考。<br>1.InnoDB不支持FULLTEXT类型的索引。<br>2.InnoDB中不保存表的具体行数，也就是说，执行select count(*) from table时，InnoDB要扫描一遍整个表来计算有多少行，但是MyISAM只要简单的读出保存好的行数即可。注意的是，当count(*)语句包含where条件时，两种表的操作是一样的。<br>3.对于AUTO_INCREMENT类型的字段，InnoDB中必须包含只有该字段的索引，但是在MyISAM表中，可以和其他字段一起建立联合索引。<br>4.DELETE FROM table时，InnoDB不会重新建立表，而是一行一行的删除。<br>5.LOAD TABLE FROM MASTER操作对InnoDB是不起作用的，解决方法是首先把InnoDB表改成MyISAM表，导入数据后再改成InnoDB表，但是对于使用的额外的InnoDB特性（例如外键）的表不适用。</p>
<p>另外，InnoDB表的行锁也不是绝对的，如果在执行一个SQL语句时MySQL不能确定要扫描的范围，InnoDB表同样会锁全表，例如update table set num=1 where name like &#8220;%aaa%&#8221;</p>
<p>任何一种表都不是万能的，只用恰当的针对业务类型来选择合适的表类型，才能最大的发挥MySQL的性能优势。<br><br><br><strong><em>转自</em></strong><a href="http://www.goood.org/2006/12/05/innodb_and_myisam/"><strong><em>http://www.goood.org/2006/12/05/innodb_and_myisam/</em></strong></a></p>
<img src ="http://www.blogjava.net/imfisher/aggbug/139156.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/imfisher/" target="_blank">愚人</a> 2007-08-24 18:05 <a href="http://www.blogjava.net/imfisher/archive/2007/08/24/139156.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>