dpaks
dpaks

Reputation: 405

MySQL Profiling

in MySQL profiling can be set using SET profiling = 1;

The query SHOW PROFILES; displays the time taken by each query. I would like to know if this time includes just the execution time at server or does it also include the time taken to send the result to frontend.

Thanks

Upvotes: 2

Views: 1832

Answers (1)

Trendfischer
Trendfischer

Reputation: 7632

According to the manual the state Sending data is the time it takes to send the result to the client. Example:

mysql> SHOW PROFILE FOR QUERY 1;
+--------------------------------+----------+
| Status                         | Duration |
+--------------------------------+----------+
| starting                       | 0.000024 |
| Waiting for query cache lock   | 0.000005 |
| checking query cache for query | 0.000051 |
| checking permissions           | 0.000010 |
| Opening tables                 | 0.000022 |
| System lock                    | 0.000012 |
| Waiting for query cache lock   | 0.000024 |
| init                           | 0.000043 |
| optimizing                     | 0.000008 |
| statistics                     | 0.000012 |
| preparing                      | 0.000011 |
| executing                      | 0.000004 |
| Sorting result                 | 0.125893 |
| Sending data                   | 0.000076 | -- here
| end                            | 0.000005 |
| query end                      | 0.000002 |
| closing tables                 | 0.000005 |
| freeing items                  | 0.000005 |
| Waiting for query cache lock   | 0.000001 |
| freeing items                  | 0.000012 |
| Waiting for query cache lock   | 0.000001 |
| freeing items                  | 0.000001 |
| storing result in query cache  | 0.000013 |
| logging slow query             | 0.000001 |
| cleaning up                    | 0.000002 |
+--------------------------------+----------+

Update: On using the query cache, the status might be sending cached result to clien.

Upvotes: 2

Related Questions