MySQL 中的多线程?
MySQL 操作是多线程的吗?
具体来说,在运行选择时,选择(或连接)算法是否会生成多个线程一起运行?多线程会妨碍支持大量并发用户吗?
Are MySQL operations multithreaded?
Specifically, on running a select, does the select (or join) algorithm spawn multiple threads to run together? Would being multi-threaded prevent being able to support a lot of concurrent users?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据 MySQL 8.0 参考手册常见问题解答:一般
但不适用于单个查询。
并行执行只能通过修改查询来实现。可以在这篇文章中找到很好的例子 通过并行查询执行提高慢速查询性能:
Start: 11:41:21 EST 2014
End: 11:41:26 EST 2014
所以总执行时间约为 5 秒(快 10 倍)。
According to MySQL 8.0 reference manual FAQ: General
But not for single query.
Parallel execution can be reached only by modifying queries. Good examples can be found in this article increasing slow query performance with parallel query execution:
Start: 11:41:21 EST 2014
End: 11:41:26 EST 2014
So the total execution time is ~5 (10x faster) seconds.
MySQL 服务器中运行多个后台线程。此外,每个数据库连接都由单个线程提供服务。 MySQL 中未实现并行查询(使用多个线程进行选择)。
MySQL本身可以支持“大量并发用户”。例如 Facebook 就通过 MySQL 成功起步。
Several background threads run in a MySQL server. Also, each database connection is served by a single thread. Parallel queries (selects using multiple threads) are not implemented in MySQL.
MySQL as is can support "a lot of concurrent users". For example Facebook started successfully with MySQL.
除了每个连接都有一个线程之外,还有几个管理进程也有自己的线程。这是 DBMS 中常见的一种安排。例如Oracle RDMS有系统监视器、数据库写入器等。
运动是缓存读取和延迟写入。
Besides each connection has a thread, there are several management processes which has it's own thread. It's an arrangement commonly seen in DBMS. E.g. Oracle RDMS has System Monitor, DB Writer and so on.
The sport is cached-reading and lazy-writing.