I hadn't even thought that you might want to monitor the process list. If this is what you want to do, I suggest innotop: http://innotop.sourceforge.net/ Not only can you see what queries are running, you can easily run EXPLAIN on them with a single keystroke (press the 'Q' key to watch the process list). You could also use it to log to a file. You can do a lot more with it than this, but that's off-topic.

Baron

Mikhail Berman wrote:
Hi Ben,

If you are running MySQL on one of NIX*.

You can use a script similar to the one I wrote to monitor one of our
DBs

==============================================
#!/bin/ksh


        while true
        do
                /bin/date >> db_access.report
/data/mysql/mysql-standard/reloc/mysql-standard-4.1.10a-sun-solaris2.9-s
parc-64bit/bin/mysqladmin -pXXXXXXXXX processlist >>
/export/home/mikhail/db_access.report
                sleep 30
done ==============================================

Then you can parse resulting db_access.report, or whatever you are going
to call the file, to see what queries are most popular.
The "sleep" defines how often the picture of activities in DB is taking

Regards,

Mikhail Berman


-----Original Message-----
From: Dan Buettner [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 20, 2007 10:34 AM
To: Ben Edwards
Cc: mysql@lists.mysql.com
Subject: Re: Getting list of queries run against a database

Ben, there's a slow query log feature that may be just what you're
looking
for:
http://dev.mysql.com/doc/refman/4.1/en/slow-query-log.html

There's an analysis script that will show you the most popular slow
queries,
too, '*mysqldumpslow'.

You can take those queries and use the EXPLAIN feature to start
analyzing
how to speed them up.

HTH,
Dan
*
On 6/20/07, Ben Edwards <[EMAIL PROTECTED]> wrote:
We are having a problem with out mysql database (4.2) and think we may
have indexes missing.  What we are trying to do is find out the most
popular queries that run.  We know there are not may and that they are
relatively simple.

Does anyone know of a tool that allows us to see what queries (i.e.
via a log file) are/have been run against the database.  If it counts
how may times/how much resources each query uses that would be good.
The icing on the cake would be a prog that told us what queries were
doing full table scans and other expensive operations.

Regards,
Ben
--
Ben Edwards - Bristol, UK
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]



--
Baron Schwartz
http://www.xaprb.com/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to