Patch adds information from SHOW PROFILE to slow.log
| MySQL Version | Comments | Version available |
|---|---|---|
| 5.0.x | Full functionality available. | build15 and later |
| 5.1.x | N/A |
The patch provides the following variables:
| Type | System and command-line variable |
| Scope | Global |
| Dynamic | Yes |
| Default | OFF |
This variable ( ON / OFF ) enables profiling of all queries (in all connections).
| Type | System and command-line variable |
| Scope | Global |
| Dynamic | Yes |
| Default | OFF |
This variable ( ON / OFF ) enables usage of getrusage function in profiling. The problem is this function is very expensive and with profiling_server enabled it can cause performance degradation
The patch adds more information to the slow log output (if profiling_server=ON) . Here is a sample log entry:
# Query_time: 4.553964 Lock_time: 0.000266 Rows_sent: 0 Rows_examined: 20000000 Rows_affected: 10000000 Rows_read: 10000000 # PROFILE_VALUES starting: 0.000101, (cpu: 0.000096) checking permissions: 0.000012, (cpu: 0.000012) Opening tables: 0.000155, (cpu: 0.000156) System lock: 0.000008, (cpu: 0.000007) Table lock: 0.000023, (cpu: 0.000023) init: 0.000027, (cpu: 0.000027) optimizing: 0.000006, (cpu: 0.000006) statistics: 0.000014, (cpu: 0.000014) preparing: 0.000010, (cpu: 0.000011) Creating tmp table: 0.000051, (cpu: 0.000052) executing: 0.000054, (cpu: 0.000053) Copying to tmp table: 0.122474, (cpu: 0.122135) converting HEAP to MyISAM: 0.094106, (cpu: 0.093955) Copying to tmp table on disk: 1.302360, (cpu: 1.300129) Sending data: 3.012816, (cpu: 2.332287) end: 0.000011, (cpu: 0.000005) removing tmp table: 0.021657, (cpu: 0.021519) end: 0.000014, (cpu: 0.000007) end: 0.000034, (cpu: 0.000034) query end: 0.000006, (cpu: 0.000006) freeing items: 0.000013, (cpu: 0.000013) closing tables: 0.000007, (cpu: 0.000007) logging slow query: 0.000003, (cpu: 0.000003) # PROFILE_TOTALS Total: 4.553962 (cpu: 3.870556) insert into teee4 select * from teee4 limit 10000000;
Discussion