MySQL InnoDB 适合这种场景吗?

发布于 2024-08-29 16:43:52 字数 310 浏览 8 评论 0原文

我的MySQL数据库包含多个MyISAM表,每个表包含数百万行。数据库上的插入负载很重,因此我无法在该实时数据库上发出 SELECT。相反,我创建数据库的副本用于查询并对其进行分析。

为了进行分析,我需要发出多个并行查询。这些查询是独立的(即,查询的结果不组合在一起),但它们大多数时候都在同一个表上操作。据我所知,每个查询都会锁定整个MyISAM表,这意味着并行独立查询会很慢。理想情况下,我更喜欢支持“NO LOCKING”的引擎。我假设 MySQL 没有这样的引擎,那么我应该使用 InnoDB 吗?我可能在这里遗漏了很多东西。请建议在这里采取什么是正确的路径。

谢谢

My MysQL database contains multiple MyISAM tables, with each table containing millions of rows. There is a heavy insert load on the database, so I cannot issue SELECTs on that live database. Instead, I create a replica of the database for queries and conduct analysis on that.

For the analysis, I need to issue multiple parallel queries. The queries are independent (i.e., the results of the queries are not combined together), but they operate on same tables most of the time. As far as I know, the entire MyISAM table is locked for each query, which means parallel independent queries would be slow. Ideally, I would prefer an engine that supports "NO LOCKING". I am assuming MySQL doesnt have such an engine, so should I use InnoDB? I might be missing lot of things here. Please suggest what is the right path to take here.

Thanks

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

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

发布评论

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

评论(2

盛装女皇 2024-09-05 16:43:52

MyISAM 读锁是兼容的,因此 SELECT 查询不会互相锁定。

如果您对副本数据库的分析查询不写入,只读取,那么使用MyISAM就可以了。

MyISAM read locks are compatible, so the SELECT queries won't lock each other.

If your analysis queries on the replica database don't write, only read, then it's OK to use MyISAM.

许久 2024-09-05 16:43:52

您可以坚持使用 MyISAM 并使用 INSERT DELAYED

当客户端使用 INSERT DELAYED 时,它会立即从服务器获得确认,并且当表没有被任何其他线程使用时,该行会排队等待插入。

使用 INSERT DELAYED 的另一个主要好处是来自许多客户端的插入被捆绑在一起并写入一个块中。这比执行许多单独的插入要快得多。

You could stick to MyISAM and use INSERT DELAYED:

When a client uses INSERT DELAYED, it gets an okay from the server at once, and the row is queued to be inserted when the table is not in use by any other thread.

Another major benefit of using INSERT DELAYED is that inserts from many clients are bundled together and written in one block. This is much faster than performing many separate inserts.

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