网站的存储引擎选择 - Myisam 还是 Innodb?

发布于 2024-11-03 05:17:49 字数 234 浏览 5 评论 0原文

作为 Craiglist 类型站点的存储引擎,什么是显而易见的选择 - MyIsam 或 InnoDb,为什么?

请解释您偏好的具体原因

Craigslist 类型的网站会有很多读取和写入,但可能会有更多读取,因为很多人来这里寻找他们想要的信息(通过搜索引擎)并且没有太多可发布的信息。 ..但刚刚找到了他们正在寻找的东西...

在这种情况下你会怎么做 Innodb 或 Myisam ?既然有读和写..?

What would be an obvious choice as a storage engine for a Craiglist type site - MyIsam or InnoDb and Why?

Please explain with specific reasons for your preference

A Craigslist type of site would have many reads as well as writes but probably more reads since lots of people came there looking for the info they wanted(through search engines)and do not have much to post ... but just found what they were looking for...

What would you do in such a case Innodb or Myisam ? Since there are both reads and writes..?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

迎风吟唱 2024-11-10 05:17:49

在 v.high level 术语中:

InnoDb

  • 支持事务
  • 行级锁定
  • 支持外键约束
  • 良好地处理大量并发写入的工作负载
  • 崩溃安全
  • 行级锁定避免了许多令人讨厌的锁定情况

MySQL

  • 无事务
  • 表级锁定
  • 支持 MERGE 表,这可能很有用
  • 适合有大量读取但没有那么多写入的工作负载
  • 不安全
  • 当运行缓慢/较差的查询时,表级锁定可能会导致令人讨厌的情况

对于我现在从事的任何新项目,我几乎肯定会选择 InnoDb。你的数据库崩溃的可能性较小,你可以利用事务并假设你在托管它的服务器上有相当大的RAM(现在RAM非常便宜),那么你应该获得非常好的性能它的。 InnoDb 在性能调整方面更为复杂,但幸运的是,它开箱即用,可以愉快地工作。

In v.high level terms:

InnoDb

  • supports transactions
  • row level locking
  • supports foreign key constraints
  • good handling for workloads with lots of concurrent writes
  • crash safe
  • row level locking avoids lots of nasty locking situations

MySQL

  • No transactions
  • Table level locking
  • supports MERGE tables which can be useful
  • Good for workloads where there are lots of reads and not so many writes
  • Not crash safe
  • Table level locking can cause nasty situations when slow/poor queries are run

For any new project I work on now I would almost definitely choose InnoDb. There's less chance of your db crashing, you can take advantage of transactions and assuming you've got a decent chunk of RAM on the server you're hosting it on (RAM is so cheap these days) then you should get really good performance out of it. InnoDb is more complicated in terms of performance tuning but with luck it'll just work happily for you out of the box.

执手闯天涯 2024-11-10 05:17:49

我更喜欢InnoDB,因为它更像是一个“真正的”数据库。此链接提供了更多详细信息:

http://www.mikebernat.com/blog/MySQL__InnoDB_vs_MyISAM

Choice quote:

“InnoDB 是事务安全的,这意味着在整个查询过程中保持数据完整性。InnoDB 还提供行锁定,而不是表锁定,这意味着当一个查询忙于更新或插入一行时,另一个查询则忙于更新或插入行。查询可以同时更新不同的行,这些功能提高了多用户并发性和性能。”

InnoDB 的大部分功能都归结为数据完整性,这总是一件好事:)

I prefer InnoDB because it is more of a "real" database. This link provides more detail:

http://www.mikebernat.com/blog/MySQL_-_InnoDB_vs_MyISAM

Choice quote:

"InnoDB is transaction-safe meaning data-integrity is maintained throughout the entire query process. InnoDB also provides row-locking, as opposed to table-locking, meaning while one query is busy updating or inserting a row, another query can update a different row at the same time. These features increase multi-user concurrency and performance."

Most of the features of InnoDB come down to data integrity, always a good thing :)

夜灵血窟げ 2024-11-10 05:17:49

简而言之,总结一下:
* MyISAM(如果您正在寻找性能)。
* InnoDB 如果您正在寻找稳健性(事务、外键)。

我总是更看重稳健性而不是性能,在项目开始时更是如此。那么就从InnoDB开始吧。一旦您的网站足够成功,您可能会考虑 MyISAM。

In short, and to summarize :
* MyISAM if you're looking for performance.
* InnoDB if you're looking for robustness (Transactions, foreign keys).

I would always favor robustness over performance, even more so at the beginning of a project. So start with InnoDB. Once your website is successful enough, you might consider MyISAM.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文