What is a Debug Profile?
How do I collect a Debug Profile?
A Debug Profile is a verbose query profile that is available in version 7.3 and later.
When profiling a query you execute it, unlike EXPLAIN.
The Debug Profile includes all the information required to analyze a query performance issue.
- DDL for all database objects relevant to the query.
- Global variable settings.
- Session variable settings.
- Table statistics metadata.
- Sampling cache for filter selectivities.
- Sampling cache for row counts.
- Autostats results cache.
To collect a Debug Profile, you need to do the following steps:
SET profile_for_debug = on;
Then you collect the JSON profile using: (we run PROFILE command twice to avoid the additional compilation time in the second run)
SHOW PROFILE JSON;
Please note that
profile_for_debug is a session variable that only applies to the SHOW PROFILE JSON operation. Due to the length of some query profiles, you may want to direct the profile to an outfile with the
INTO OUTFILE '/path' option.
If you use the STUDIO, you can just click on the
Save as CSVbutton.
SHOW PROFILE JSON INTO OUTFILE '/tmp/debug_profile.json';