List:General Discussion« Previous MessageNext Message »
From:Ana Leite Date:June 3 2005 11:45pm
Subject:SQL for performance statistics
View as plain text  
Hi all,
 
I'm new to MySQL and I'm trying to write a program that among other things monitors
database usage. I would like to write an SQL query to retrieve info like session id, user
name, cpu usage. Is there any MySQL system tables that gives me this sort of information?
 
To be more precise, I'm trying to get the MySQL equivalent of the following Oracle SQL:
 
select 
   sesstat.sid as sid, 
   sess.username user, 
   sess.status as status, 
   sess.program as program, 
   aud.name as command, 
   sesstat.value / 100 as cpu, 
from 
   V$STATNAME statname, 
   V$SESSTAT sesstat, 
   V$SESSION sess, 
   sys.audit_actions aud 
where 
   statname.statistic# = sesstat.statistic# 
   and 
   sess.sid = sesstat.sid 
   and 
   sess.username is not null 
   and 
   statname.name = 'CPU used by this session' 
   and 
   aud.action  = sess.command
order by 
   sess.sid 
 
thanks!
 
Ana
 

 

__________________________________________________
Converse com seus amigos em tempo real com o Yahoo! Messenger 
http://br.download.yahoo.com/messenger/ 
Thread
SQL for performance statisticsAna Leite4 Jun
  • Re: SQL for performance statisticsDan Nelson4 Jun