mysql的存儲引擎主要有:MyISAM和InnoDBmysql
MyISAM和InnoDB的主要區別:InnoDB支持事務和參照完整性(即爲主鍵約束,數據庫的主鍵和外鍵類型必定要一致)sql
存儲引擎是針對表而言而非針對數據庫而言的,這點很重要!咱們能夠根據不一樣的表選擇不一樣的存儲引擎,如mysql數據中,默認的mysql這個表,存儲引擎就是MyISAN數據庫
stackoverflow上的一段話:session
The main differences between InnoDB and MyISAM ("with respect to designing a table or database" you asked about) are support for "referential integrity" and "transactions".併發
If you need the database to enforce foreign key constraints, or you need the database to support transactions (i.e. changes made by two or more DML operations handled as single unit of work, with all of the changes either applied, or all the changes reverted) then you would choose the InnoDB engine, since these features are absent from the MyISAM engine.app
Those are the two biggest differences. Another big difference is concurrency. With MyISAM, a DML statement will obtain an exclusive lock on the table, and while that lock is held, no other session can perform a SELECT or a DML operation on the table.(ide
另外一個大的區別是併發。使用MyISAM,DML語句將得到對錶的排它鎖,而且在該鎖被保持時,沒有其餘會話能夠對錶執行SELECT或DML操做。ui
)this
Those two specific engines you asked about (InnoDB and MyISAM) have different design goals. MySQL also has other storage engines, with their own design goals.(每一個存儲引擎都有本身的設計目標,根據實際狀況選擇適合本身的存儲引擎)spa
So, in choosing between InnoDB and MyISAM, the first step is in determining if you need the features provided by InnoDB. If not, then MyISAM is up for consideration.
A more detailed discussion of differences is rather impractical (in this forum) absent a more detailed discussion of the problem space... how the application will use the database, how many tables, size of the tables, the transaction load, volumes of select, insert, updates, concurrency requirements, replication features, etc.
The logical design of the database should be centered around data analysis and user requirements; the choice to use a relational database would come later, and even later would the the choice of MySQL as a relational database management system, and then the selection of a storage engine for each table.
參考連接:
https://support.rackspace.com/how-to/mysql-engines-myisam-vs-innodb/