MySQL Performance Schema – Comprehensive Guide

MySQLperformance

My company hosts a mysql database on google and we do not have complete control over the customization involved. Recently we attempted to turn performance schema on to help debug some common complaints about our software. During the restart that was required after adjusting the flag the database was continually failing to start which caused massive problems with our customers as you can imagine.

At this point it looks like performance schema and everything that falls under its umbrella is essentially out of the question. Are there any other tools or ways to analyze a mysql database if the performance schema features are inaccessible? Aside from looking at the execution plan of every query manually.

Best Answer

The slowlog is my favorite means of quickly identifying performance problems. (I don't care for the performance_schema.) Set long_query_time=1 globally, turn on the slowlog, wait a day, then look at the log

The slowlog can be sent to a file. If you don't have access to the filesystem, what version of MySQL you are using? In newer versions, the slowlog can be sent to a table, thereby avoiding the need for access to the disk.

If possible, use pt-query-digest to summary the slowlog file. The first few queries will be the "worst". We can help you speed them up, possibly by adding a "composite" index, possibly by modifications to the query, possibly by schema redesign, etc.