enable profiling for a specific user/session

Hi,

I have had problems with some sqls generated by an specific user used in an application.

is there a way to enable profiling to that user since my session?

I have enable slow query option and queries not using index but i want to know if i can enable profiling? Or how can i know the resource usage for statements executed during the course of that session.

Thanks for your help.

If you use Percona Server you can track usage based on users using INFORMATION_SCHEMA.USER_STATISTICS.

http://www.percona.com/docs/wiki/patches:userstatv2

You can use the slow query log. If you are using MySQL 5.1 (or Percona Server 5.0) you can log all queries to the log by setting long_query_time to 0.

You can use mk-query-digest to process the log, and the --filter functionality to look at queries only for a particular user.
http://www.maatkit.org

–Justin