How to profile MySQL during a period of time
In my experience, PROFILE always said that 99% of the time was spent in some &quot;useless&quot;  category, such as &quot;sending data&quot;.  Such categories 'never' translated into anything actionable.  PROFILE is being deprecated -- good riddance.
EXPLAIN SELECT ... and EXPLAIN FORMAT=JSON ... have some use.  So does the &quot;optimizer trace&quot;.
Use the slowlog: mysql.rjweb.org/doc.php/mysql_analysis#slow_queries_and_slowlog And you can do that on a live system.
Another technique for looking into what is going on is with the &quot;Handler&quot; counts.  This works even when a table is [currently] so small that timings are not very useful.  Details:  http://mysql.rjweb.org/doc.php/index_cookbook_mysql#handler_counts