List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:February 20 2000 3:48am
Subject:Re: slow queries
View as plain text  
In the last episode (Feb 19), Adam Powell said:
> Watching top on our database machine, I see the odd mysqld process that
> claims 99% CPU for about 3-4 seconds... which is bad.  I run a large site,
> and its impossible to keep track of every single mysql command within the
> site.  One of them is a badly written query that is slowing down all the
> rest of the queries.
> Is it possible to work out exactly what query is causing this?  Can I
> somehow get this information by looking at the PID of the process?  Is there
> a way I can automatically log any queries that take over a certain time to
> execute?

3.23.10 has a "slow-query" logfile, which logs a timestamp, execution
time, and the query text for any queries exceeding the
"long_query_time" value (10 seconds by default, but adjustable).

If you don't want to run 3.23, your best bet would be to have a shell
open with "mysqladmin proc" all typed in, and hit ENTER when you see
mysql start hogging the CPU :)

	Dan Nelson
slow queriesAdam Powell19 Feb
  • Re: slow queriessinisa19 Feb
  • Re: slow queriesDan Nelson20 Feb