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;
This procedure will be executed in parallel.
Can I write such procedure in MySQL? Can MySQL execute a procedure in a separate thread?
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/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.