MySQL Forums
Forum List  »  Performance

mysql: status - how are questions counted?
Posted by: Allen Arakaki
Date: July 12, 2005 01:18PM

I use mysql and the status command to give me a general idea how my application is performing: threads, questions, slow queries, opens, etc are very helpful. I am befuddled at how the status command counts the questions.

Currently, I'm using
mysql Ver 14.7 Distrib 4.1.12a, for Win32 (ia32), but I've tried it on linux rhel v3.0 with similar results. I have a java application and using the Connector/J v3.1.8.

If I run the following from the mysql text command line:

mysql> status
... Threads: 1 Questions: 6103 Slow queries: 0 ...
mysql> status
... Threads: 1 Questions: 6105 Slow queries: 0 ...

Why does running status increment the Questions by 2? Shouldn't it be 1?

If I execute a simple sql select statement (from the command line), I get Count-Questions: 3 ... which makes sense, after I subtract 2 to account for the status.

If I execute the same sql statement from my java application I get a Count-Questions: 9 ... and after subtracting 2, it means that my simple sql statement executed from java resulted in 7 questions. Why is that?

So executing the following:
mysql> status
<sql statements>
mysql> status

if <sql statements> is from mysql command line, then the formula is
# sql statements = status2 - status1 - 2;

if <sql statements> is from my java app, then the formula is
# sql statements = (status2 - status1 - 2)/7;

This is a bit worrisome, since I am assuming the number of questions that mysql has to process is time-consuming. More questions that need to be processed, the more time it takes mysql to process my sql statements.

How are "Questions" counted in the mysql status command?

In my application I do the following:
Open Db
Open Connection
Create Statement
<execute the statement>
Close Statement
Close Connection
Close Db
This explains the count of 7. Is this how mysql counts questions?

How does executing batch affect the number of questions counted?

How do #questions processed relate to mysql performance. Should I be worried about the number of questions that are processed, or the number of statements that are processsed?

If I use connection pooling, the best I can do is reduce the questions' count to 3 (eliminate the need to open/close db and connection). Does stored procedures reduce the questions' count to 1 (by eliminating the need to create/close a statement)?

Please enlighten me on how mysql counts questions/statements.

Thanks

Options: ReplyQuote


Subject
Views
Written By
Posted
mysql: status - how are questions counted?
3707
July 12, 2005 01:18PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.