程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> InnoDB和MyISAM區別

InnoDB和MyISAM區別

編輯:MySQL綜合教程

InnoDB和MyISAM是許多人在使用MySQL時最常用的兩個表類型,這兩個表類型各有優劣,視具體應用而定。以前MySQL 默認的存儲引擎是MYISAM,從5.5.5之後就改用InnoDB了。它們的基本的差別為:MyISAM類型不支持事務處理等高級處理,而InnoDB類型支持。MyISAM類型的表強調的是性能,其執行數度比InnoDB類型更快,但是不提供事務支持,而InnoDB提供事務支持已經外部鍵等高級數據庫功能。
MyIASM是IASM表的新版本,有如下擴展:
·二進制層次的可移植性。
·NULL列索引。
·對變長行比ISAM表有更少的碎片。
·支持大文件。
·更好的索引壓縮。
·更好的鍵嗎統計分布。
·更好和更快的auto_increment處理。
 
以下是一些細節和具體實現的差別:
 
◆1.InnoDB不支持FULLTEXT類型的索引。
◆2.InnoDB 中不保存表的具體行數,也就是說,執行select count(*) from table時,InnoDB要掃描一遍整個表來計算有多少行,但是MyISAM只要簡單的讀出保存好的行數即可。注意的是,當count(*)語句包含where條件時,兩種表的操作是一樣的。
◆3.對於AUTO_INCREMENT類型的字段,InnoDB中必須包含只有該字段的索引,但是在MyISAM表中,可以和其他字段一起建立聯合索引。
◆4.DELETE FROM table時,InnoDB不會重新建立表,而是一行一行的刪除。
◆5.LOAD TABLE FROM MASTER操作對InnoDB是不起作用的,解決方法是首先把InnoDB表改成MyISAM表,導入數據後再改成InnoDB表,但是對於使用的額外的InnoDB特性(例如外鍵)的表不適用。
 
在高性能MYSQL上還說默認MYISAM,其實要看那個版本,我現在的默認就是InnoDB,手冊上是這麼說的:
InnoDB is a high-reliability and high-performance storage engine for MySQL. Starting with MySQL 5.5, it is the default MySQL storage engine. Key advantages of InnoDB include:
Its design follows the ACID model, with transactions featuring commit, rollback, and crash-recovery capabilities to protect user data.
Row-level locking and Oracle-style consistent reads increase multi-user concurrency and performance.
InnoDB tables arrange your data on disk to optimize common queries based on primary keys. Each InnoDB table has a primary key index called the clustered index that organizes the data to minimize I/O for primary key lookups.
To maintain data integrity, InnoDB also supports FOREIGN KEY referential-integrity constraints.
You can freely mix InnoDB tables with tables from other MySQL storage engines, even within the same statement. For example, you can use a join operation to combine data from InnoDB and MEMORY tables in a single query.
To determine whether your server supports InnoDB use the SHOW ENGINES statement.
 
Before MySQL 5.5.5, MyISAM is the default storage engine. (The default was changed to InnoDB in MySQL 5.5.5.) MyISAM is based on the older (and no longer available) ISAM storage engine but has many useful extensions.
Table 13.10. MyISAM Storage Engine Features


  Storage limits 256TB Transactions No Locking granularity Table MVCC No Geospatial data type support Yes Geospatial indexing support Yes B-tree indexes Yes Hash indexes No Full-text search indexes Yes Clustered indexes No Data caches No Index caches Yes Compressed data Yes[a] Encrypted data[b] Yes Cluster database support No Replication support[c] Yes Foreign key support No Backup / point-in-time recovery[d] Yes Query cache support Yes Update statistics for data dictionary Yes  

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved