06-22-2009
Quote:
Originally Posted by
vidyadhar85
you want it along with the query or only top 10 time??
only top 10 time
---------- Post updated at 06:38 AM ---------- Previous update was at 05:59 AM ----------
Quote:
Originally Posted by
kaushik02018
It is slow-log file I have to find highest time taken on the basis of query time
so any command that show top n query time
file is as follow
# Query_time: 2.562404 Lock_time: 0.000018 Rows_sent: 509 Rows_examined: 509
use testanalytics;
SET timestamp=1238053872;
SELECT * FROM `testanalytics`.`anlytcs_mt_dt`;
# Query_time: 12.080983 Lock_time: 0.000034 Rows_sent: 1270 Rows_examined: 2540
SET timestamp=1238116828;
SELECT * FROM `anlytcs_mt_dt`
ORDER BY `anl_evnt_id` DESC;
# User@Host: root[root] @ [10.157.205.10]
# Query_time: 18.391643 Lock_time: 0.000017 Rows_sent: 22296 Rows_examined: 22296
use test_analytics;
SET timestamp=1238455961;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `test_analytics`.`dim_tm`;
# Query_time: 17.690604 Lock_time: 0.000018 Rows_sent: 22296 Rows_examined: 22296
use test_analytics;
SET timestamp=1238461385;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `test_analytics`.`dim_tm`;
any command for result top n Query_time:
I got command
grep "Query_time" /home/slow-log-new.log | sort -n -k3 -r > /tmp/queries_sorted_by_time &
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am new to unix.Can you please tell me whether there is any command to search for a file in all the directories... and also i want to search for an expression in all the directories.
Thanks in advance.
Regards,
Harika Mamidala (3 Replies)
Discussion started by: harikamamidala
3 Replies
2. UNIX for Dummies Questions & Answers
Hello,
I have a file and in that, I want to search for a aprticular word and then replace another word in the same line with something else.
Example: In file abc.txt, there is a line
<host oa_var="s_hostname">test</host>
I want to search with s_hostname text and then replace test with... (2 Replies)
Discussion started by: sshah1001
2 Replies
3. Shell Programming and Scripting
Let me give you a complete example what I am trying to achieve.
1. Below is the log file structure where I need 2,5 and 14th column of the logs after grepping through the linkId=1ddoic.
Log file structure:-
abc.com 20120829001415 127.0.0.1 app none11111 sas 0 0 N clk Mozilla/5.0... (3 Replies)
Discussion started by: kmajumder
3 Replies
4. Shell Programming and Scripting
I have two files:
file 1:
hello.com neo.com,japan.com,example.com
news.net xyz.com, telecom.net, highlands.net, software.com
example2.com earth.net, abc.gov.uk
file 2:
neo.com
example.com
abc.gov.uk
file 2 are the search keys to search in file 1 if any of the search... (7 Replies)
Discussion started by: csim_mohan
7 Replies
5. Shell Programming and Scripting
Hi,
Can someone please help me with a Command to Search a FILE for a STRING in multiple DIRECTORIES.
I am searching for the VIP in HTTPD.CONF in multiple httpd instances.
I am using
find ./ -name "httpd.conf" | xargs grep 10.22.0.141 cut -d: -f3- | cut -d ' ' -f4 | sort | uniq -c
... (1 Reply)
Discussion started by: crosairs
1 Replies
6. Shell Programming and Scripting
how to search and replace string in column in file with command sed or other
search "INC0000003.in" and replace column 4 = "W"
$ cat file.txt
INC0000001.in|20150120|Y|N|N
INC0000002.in|20150120|Y|N|N
INC0000003.in|20150120|Y|N|N
INC0000004.in|20150120|Y|N|Noutput... (4 Replies)
Discussion started by: ppmanja3
4 Replies
7. Shell Programming and Scripting
I 'm writing a script to search particular strings from log files. The log file contains lines start with *. The file may contain many other lines start with *. I need to search a particular line from my log file. The grep command is working in command line , but when i run my script, Its printing... (7 Replies)
Discussion started by: vinus
7 Replies
8. Shell Programming and Scripting
Hi,
How can I use find command to search string/pattern in a file recursively?
What I tried:
find . -type f -exec cat {} | grep "make" \;
Output:
grep: find: ;: No such file or directory
missing argument to `-exec'
And this:
find . -type f -exec cat {} \; -exec grep "make" {} \;... (12 Replies)
Discussion started by: cola
12 Replies
9. Shell Programming and Scripting
Hi All,
This query is regarding performance improvement of a command.
I have a list of IDs in a file (say file1 with single ID column) and file2 has the data rows.
I need to get the IDs from file1 and search in file2, matching rows from file2 should be written to a file3.
For this... (4 Replies)
Discussion started by: Tanu
4 Replies
10. UNIX for Beginners Questions & Answers
I have requirement to search for a text in the file and retrieve required lines that is user defined with unix command.
Eg:
Find the text UNIX in the below file and need to return Test 8 & Test 9
Test 1
Test 2
Test 3
Test 4
UNIX
Test 5
Test 6
Test 7
Test 8
Test 9
Result can... (8 Replies)
Discussion started by: Arunkumarsak4
8 Replies