Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql count how many queries per second are executed, is there any way?

i have a busy web server with LAMP installed, and i was wondering, is there any way to count how many queries per second (mysql) are executed in the server ?

Thank you.

like image 782
Nikos Avatar asked May 02 '10 18:05

Nikos


People also ask

How many queries can MySQL handle per second?

MySQL can run more than 50,000 simple queries per second on commodity server hardware and over 2,000 queries per second from a single correspondent on a Gigabit network, so running multiple queries isn't necessarily such a bad thing.

How do you measure a query per second?

How do I calculate QPS? It's pretty simple actually. If you know the number of queries you currently processes per second, take that number and plug it into formula: QPS x 60 seconds per minute x 60minutes per hour x 24 hours per day x 30.41 average days per month.

Which query will take more time for execution?

There are a number of things that may cause a query to take longer time to execute: Inefficient query – Use non-indexed columns while lookup or joining, thus MySQL takes longer time to match the condition. Table lock – The table is locked, by global lock or explicit table lock when the query is trying to access it.


1 Answers

SELECT s1.variable_value / s2.variable_value
FROM information_schema.global_status s1, information_schema.global_status s2
WHERE s1.variable_name='queries'
AND s2.variable_name ='uptime';
like image 120
n00b Avatar answered Sep 28 '22 08:09

n00b