简体   繁体   English

是InnoDB还是MyISAM?

[英]InnoDB or MyISAM?

I have two tables: Users and Friendships. 我有两个表:“用户”和“友谊”。 The actions I have in the website are: 我在网站上执行的操作是:

  • Register 寄存器
  • Log in 登录
  • Select friends/people from users table 从用户表中选择朋友/人
  • Add people as friends 加人为朋友

There are a little more actions but in general i wanted to know : 还有更多动作,但总的来说,我想知道

The Question: 问题:

Should I use InnoDB or MyISAM for the tables ? 我应该对表使用InnoDB还是MyISAM吗? ( Or InnoDB for one and MyISAM for the other ? ) (或者一个是InnoDB,另一个是MyISAM?)

Always use InnoDB unless you specifically want to include a FULLTEXT index on a particular table. 除非您特别想在特定表上包括FULLTEXT索引,否则请始终使用InnoDB。 Only InnoDB enforces foreign keys, and the more referential integrity you can build into the database the better off everyone's going to be. 只有InnoDB强制执行外键,并且可以在数据库中构建的参照完整性越高,每个人的情况就越好。

Use InnoDB. 使用InnoDB。 You get foreign key constraints, transactions (so you can insert into two tables and either they both get committed or neither, so you aren't left with inconsistent information). 您将获得外键约束和事务(因此您可以插入两个表,并且它们要么都提交,要么都不提交,因此不会留下不一致的信息)。

However, there is another big advantage. 但是,还有另一个很大的优势。 InnoDB supports MVCC (multi-versioning concurrency). InnoDB支持MVCC(多版本并发)。 This means that, while a transaction is operating on a row, other transactions/statements can see the old value of the row. 这意味着,当一个事务在一行上运行时,其他事务/语句可以看到该行的旧值。 With MyISAM that operation would block. 使用MyISAM,该操作将被阻止。 Less blocking means you can have more users operating concurrently on your data set. 更少的阻塞意味着您可以让更多用户同时对数据集进行操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM