How can i know how many queries are fired in my database?

I have a employee management application . I am using mysql db.

In my application , i have functionality like add /edit/delete /view .

Whenever i run any functionality , one query is fired in database. Like in add employee , it will fire insert query.

So i want to do something on my database, so that in see how many queries have been fired till date?

I dont want to do any changes on my java code.



You can use SHOW STATUS:


As documented under Server Status Variables:

The status variables have the following meanings.

[ deletia ]



    The number of statements executed by the server. This includes only statements sent to the server by clients and not statements executed within stored programs, unlike the Queries variable. This variable does not count COM_PING, COM_STATISTICS, COM_STMT_PREPARE, COM_STMT_CLOSE, or COM_STMT_RESET commands.

    </li> </ul>

    Beware that:


      the statistics are reset when FLUSH STATUS is issued.

      </li> <li>

      the SHOW STATUS command is itself a statement and will increment the Questions counter.

      </li> <li>

      these statistics are server-wide and therefore will include other databases on the same server (if any exist)—a feature request for per-database statistics has been open since January 2006; in the meantime one can obtain per-table statistics from google-mysql-tools/UserTableMonitoring.

      </li> </ul>


      You should execute queries as mentioned below:

      <ol> <li>

      To get SELECT query count execute Show global status like 'com_select';

      </li> <li>

      To get UPDATE query count execute Show global status like 'com_update';

      </li> <li>

      To get DELETE query count execute Show global status like 'com_delete';

      </li> <li>

      To get INSERT query count execute Show global status like 'com_insert';

      </li> </ol>

      You can also analyze General log or route your application via MySQL proxy to get all queries executed on a server.


      If you don't want to modify your code then you can trace this on the database with triggers. The restriction is that triggers can only fire on insert/update/delete so can't be used to count reads (selects).


      Maybe it's too "enterprise" and too "production" for your question.

      When you use munin (http://munin-monitoring.org/) (other monitoring-tools have simular extenstions), you can use mysql-monitoring tools which show you how many requests (splitted in Insert/Update/Loaddata/...) you are firing.

      With these tools, you see the usage and the load you are producing. Especially when data changes, and may cause more accesses/load (missing indices, more queries because of big m:n-tables, ...) you recognize it.

      It's extremely handy and you can do the check during your break. No typing, no thing, just check the graphs.


      I think that the most exact method, which needs no modifications to the database or application in order to operate, would be to configure your database management system to log all events.

      You are left with a log file, which is a text file that can be analyzed on demand.

      Here is the The General Query Log manual page that will get you started.


  • Adjust size of pie charts
  • MySQL: list of sum for several conditions in one SQL statement
  • Refresh page when directory content changes
  • Checking permission of a file using python
  • Set and get Notes field in CRM 2011 Javascript
  • Create a directory
  • Close multiple files
  • barcode fonts vs barcode printer fonts
  • boost::filesystem::exists crashs
  • How to handle Win32 Application termination
  • Compiling z3 ocaml binding in linux
  • RPC Client gives Can't encode arguments
  • R colour scale for logarithmic data?
  • Is it possible to definitively identify whether a DML command was issued from a stored procedure?
  • Bitbucket Webhooks
  • What to return when a route/url is found but not the resource behind it?
  • Copy a file block per block in C
  • C/C++ - Mac OS X - Check If file exists
  • Mixing PDO and MySQL Functions?
  • C++ Copy directory recursive under unix
  • Python Pandas Mixed Boolean Yes/True and NaN Columns
  • Serializable transactions not protecting me from double inserts
  • SSIS - SQL Server datetimeoffset(0) destination column recognized as DT_WSTR
  • How can I find the Size of some specified files?
  • Beginner in SQLite
  • R encoding ASCII backtick
  • Declare struct containing time_t field in Python CFFI
  • Input buffer flush
  • Python Paramiko send CTRL+C to an ssh shell
  • Recreate the Oracle DUAL table
  • How to handle empty space in url when downloading image from web?
  • How dotnet build chooses the output name
  • How to Save JSON data to SQL server database in C#?
  • Can you pass an array from javascript to asp.net mvc controller action without using a form?
  • How to Cache Real-time Data?
  • Is there a way to do normal logging with EureakLog?
  • PHP buffered output depending on server setting?
  • What is the “return” in scheme?