Mytop is monitoring software for MySQL written by Jeremy Zawodny with a similar look and feel to the Unix application top. Mytop gives the user the ability to monitor what is happening, in real time, within the MySQL server; everything from number of queries per second to key efficiency of the queries.
While database optimization starts with the programmer writing good SQL queries, mytop comes in handy to monitor what is happening on the server and provide a way for the administrator of the system to better optimize the server to handle the load.
Mytop gives us a lot of information but understanding what mytop is actually telling us with the information is not easy from the start. There are currently two views in mytop version 1.4 but version 1.5 promises to add another view making three views in total.
The first view we will discuss is the view we see when mytop starts running. This view is called the "thread view". You can get back to this view at anytime by pressing the "t" key. The next view is the "command view" which shows us how many different types of queries have been run since the server started or since the counters were reset and also since the last time mytop refreshed. This view is helpful to know if your server is doing more Selects than Inserts or Updates. You get to this view by pressing the "c" key. The information the command view provides is important because if your server is doing a lot more Selects than Inserts or Updates then you know you should probably be running MySQL 4.0 with query cache turned on so that your system will respond faster to the selects.
If your MySQL server is doing a lot more Inserts and Updates than Selects then you know query cache probably wont help you speed up your system so you will have to find other ways to optimize the MySQL server to better respond to increase load and users on the system.