将光标移到/点击文章中的句子上,可以查看译文。      显示繁体中文内容    显示简体中文内容

Implementing a MySQL command progress bar
实现MySQL命令进度栏

0 0

We are trying to parse a file and store it in a MySQL database. the commands will be importing a large trace file the could be several gigabytes in size, so it it may of interest for the user to track the progress of the command. we are using the following command :


String commandText ="SET AUTOCOMMIT = 0;"
 +"START TRANSACTION;"
 +"LOAD DATA LOCAL INFILE '" + filePath +"'"
 +"INTO TABLE testdatabase.metadata"
 + @"FIELDS TERMINATED BY 't'"
 + @"LINES TERMINATED BY 'n'"
 +"(Position,"
 +"Timespace,"
 +"Duration,"
 +"Disk,"
 +"Request,"
 +"Sector,"
 +"Length);"
 +"COMMIT;";


Is there a way to track the progress while the command is being executed in order to implement a progress bar?

时间: 原作者:

0 0

You can make a progress bar that changes progress based on the stage a query is in. it's definitely possible to put a GUID in a comment somewhere in the query, then use SHOW FULL PROCESSLIST to figure which stage a query is in. but there's no exact way of gauging actual progress. with InnoDB you can try using SHOW INNODB STATUS but even this isn't precise.

原作者:
...