|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
I have set long query time to 2 seconds in my cnf file.
Therefore all the queries taking more than 2 seconds are logged in the file called mysql-slow.log and the file size is 20 Mb. Is there anyway to sort this file and find out the queries those are taking the most time so that I can optimize only those ones? Here is how the file look like.... # Time: 080319 16:32:11 # User@Host: root[root] @ [192.29.0.134] # Query_time: 5 Lock_time: 0 Rows_sent: 0 Rows_examined: 0 INSERT INTO queryLog SET id = '', filename = 'intermediate.php',queryLength = '72',exeTime = '0'; # Time: 080319 17:13:33 # User@Host: root[root] @ [192.29.3.143] # Query_time: 9 Lock_time: 0 Rows_sent: 1 Rows_examined: 872116 select distinct(business_group) from d_jds.tbl_company_master limit 10; |
|
#2
|
|||
|
|||
|
grep -n Query_time mysql-slow.log | sort -k 3,3nr
7:# Query_time: 9 Lock_time: 0 Rows_sent: 1 Rows_examined: 872116 3:# Query_time: 5 Lock_time: 0 Rows_sent: 0 Rows_examined: 0 Then use the line numbers from grep to examine the longest running query # sed -n '7,/;$/p' mysql-slow.log # Query_time: 9 Lock_time: 0 Rows_sent: 1 Rows_examined: 872116 select distinct(business_group) from d_jds.tbl_company_master limit 10; |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Data from log files |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|