revious example:

Connection 1> ANALYZE SELECT ... ;

Connection 2> SHOW ANALYZE FORMAT=JSON FOR <connection_id>;
ANALYZE
{
 "r_query_time_in_progress_ms": 30727,
 "query_block": {
  "select_id": 1,
  "r_loops": 1,
  "nested_loop": [
   {
    "table": {
     "table_name": "customer",
     "access_type": "ALL",
     "possible_keys": ["PRIMARY"],
     "r_loops": 1,
     "rows": 199786,
     "r_rows": 109994,
     "r_table_time_ms": 232.699,
     "r_other_time_ms": 46.355,

^ Now, ANALYZE prints timing information in members named r_..._time_ms. One
can see that so far, out of 30 seconds, only 232 millisecond were spent in
reading the customer table. The bottleneck is elsewhere...

"filtered": 100,
     "r_filtered": 9.085950143,
     "attached_condition": "customer.`status` = 'GOLD'"
    }
   },
   {
    "table": {
     "table_name": "orders",
     "access_type": "ref",
     "possible_keys": ["cust_id"],
     "key": "cust_id",
     "key_length": "5",
     "used_key_parts": ["cust_id"],
     "ref": ["test.customer.cust_id"],
     "r_loops": 9994,
     "rows": 1,
     "r_rows": 99.99779868,
     "r_table_time_ms": 29460.609,
     "r_other_time_ms": 986.842,

^ 29.4 seconds were spent reading the orders table (and 0.986 seconds in
processing the obtained rows). Now we can see where the query is spending time.

"filtered": 100,
     "r_filtered": 100
    }
   }
  ]
 }
}

URL: https://mariadb.com/kb/en/show-analyze/https://mariadb.com/kb/en/show-analyze/