Profiling
Profiling permits you to benchmark information that indicates resource usages during a session. This is used when we want to get information on a specified query. Here are the types of information:
Block I/O
Context switches
CPU
IPC
Memory
Page faults
Source
Swaps
All
First of all, you need to know that profiling on a production server is not recommended because of the performance degradation it can cause.
To enable profiling, use the following command:
MariaDB [none]> SET PROFILING=1;
Perform all the query tasks you want to profile and then list them:
MariaDB [none]> SHOW PROFILES; +----------+------------+-------------------------+ | Query_ID | Duration | Query | +----------+------------+-------------------------+ | 1 | 0.30798532 | select * from s_explain | | 2 | 0.25341312 | select * from s_explain | +----------+------------+-------------------------+
In the preceding command-line output, you can see that we've two query IDs. To get information...