在MySQL中同时创建索引 [英] Creating indexes concurrently in MySQL

查看:115
本文介绍了在MySQL中同时创建索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在pl/sql中找到了一个过程,该过程使用多个线程创建索引:

I found a procedure in pl/sql that creates indexes with multiple threads:

declare l_job number;
begin
    dbms_job.submit( l_job, 'execute immediate ''alter index idx1 rebuild'';' );
    commit;
    dbms_job.submit( l_job, 'execute immediate ''alter index idx2 rebuild'';' );
    commit;
end;

此过程将并行执行.

我可以在MySQL中编写这样的过程吗? MySQL可以在单独的线程中执行过程吗?

Can I write such procedure in MySQL? Can MySQL execute a procedure in a separate thread?

推荐答案

在MySQL中,每个客户端连接获得1个线程.为了做到这一点,您需要为希望重建的每个索引启动一个客户端实例,并并行运行这些客户端.该链接讨论了当前的限制:

In MySQL you get 1 thread per client connection. To make this parallel, you would need to fire up a client instance for each index you wished to rebuild and run those clients in parallel. This link talks about the limitation at hand: http://www.mysqlperformanceblog.com/2010/10/27/mysql-limitations-part-4-one-thread-per-connection/

这篇关于在MySQL中同时创建索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆