MySQL - Profiling Slow Queries

To enable logging of slow queries, do this with the mysql shell:

set global slow_query_log = 1;
set global long_query_time = 0.05; // logs queries slower than 50ms
set global log_output = 'TABLE';
flush logs;

Then after several queries have run, you can view the slow log table like this:

use mysql;
select * from slow_log;

Since slow query logging can have an impact on database I/O, to disable:

set global slow_query_log = 0;

Note: if you receive any errors running the above commands, you might need to have your database access role escalated. Please create a ticket if needed.