Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a running script which is inserting data into a MySQL database.

I want to know how many rows are getting inserted per second and per minute. If the count of rows inserted per second or per minute goes beyond a certain count, I need to stop executing the script.

How can I monitor this?

share|improve this question
up vote 2 down vote accepted

You should be able to derive that information from the output of

mysqladmin extended-status


show status like 'Innodb_rows_inserted';

in MySQL, run every minute.

Or for individual databases or tables, you could use information from information_schema.TABLES:

select TABLE_NAME, TABLE_ROWS from information_schema.TABLES 
    where TABLE_SCHEMA = 'my-database';
share|improve this answer
That sounds about right. I also found out a command called watch, which lets me monitor the amount of records inserted per sec. – The Dark Knight Feb 21 '13 at 6:54

There are ways to do this via some count() on the db, but i think this will always be kind of ugly and just slow the execution of your script down. So the best way to do it is inside the script itself.

For example after every 1000 inserts you check the time since the last 1000 and then decide what to do.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.