I have two scripts put into a cron that runs every single minute. Both the scripts connect to the same database and runs a show full processlist
. Is it okay if two show full processlist
commands are run at the same time?
P.S:- One of the scripts will be removed in a week or so, so this setup is only for one week at the most.
Yes, it is OK. Even if not, it would be MySQL's job to deal with the problem, e.g. by delaying the second until the first is finished.
What is the difference between
SHOW PROCESSLIST;
andSHOW FULL PROCESSLIST;
?SHOW PROCESSLIST;
displays the first 100 characters of the INFO columnSHOW FULL PROCESSLIST;
displays the entire INFO columnFrom the INFORMATION_SCHEMA.PROCESSLIST point-of-view:
SHOW PROCESSLIST;
effectively runsSELECT ID,USER,HOST,DB,COMMAND,TIME,STATE,LEFT(INFO,100) INFO FROM information_schema.processlist;
SHOW FULL PROCESSLIST;
effectively runsSELECT * FROM information_schema.processlist;
There is only one circumstance I can think of where you do not want to run
SHOW FULL PROCESSLIST;
.When you a loading a mysqldump into a MySQL instance, you run
SHOW PROCESSLIST;
to track the progress of a table's load. We know that mysqldumps have extended INSERTs. That single INSERT can have hundreds, or even thousands, or rows. If you runSHOW FULL PROCESSLIST;
, you can spill the text representation of those hundreds, or even thousands, or rows to the console or to a log. That can quickly generate huge logs of SQL queries with data visible as plain text.So, be very careful not to be running multiple
SHOW FULL PROCESSLIST;
commands during a load of a mysqldump.If you have do some monitoring of the processlist, you can either
SHOW PROCESSLIST;
SELECT ID,USER,HOST,DB,COMMAND,TIME,STATE,LEFT(INFO,300) INFO FROM information_schema.processlist;
(setting LEFT(INFO,xxx) to whatever manageable length)