Tikejhya: Ashish Nepal

Knowledgebase

Month: January 2013

mysqldumpslow – Unix, Linux Command

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

mysqldumpslow – Unix, Linux Command

The MySQL slow query log contains information about queries that take a long time to execute.

Long = Time mentioned in sec in my.cnf
by default it uses 10s

log-slow-queries

For more details on my.cnf click here

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

mysqldumpslow -s c -t 10 ashishMysQL-slow.log

Other options:

Usage: mysqldumpslow [ OPTS… ] [ LOGS… ]

Parse and summarize the MySQL slow query log. Options are

–verbose verbose
–debug debug
–help write this text to standard output

-v verbose
-d debug
-s ORDER what to sort by (al, at, ar, c, l, r, t), ‘at’ is default
al: average lock time
ar: average rows sent
at: average query time
c: count
l: lock time
r: rows sent
t: query time
-r reverse the sort order (largest last instead of first)
-t NUM just show the top n queries
-a don’t abstract all numbers to N and strings to ‘S’
-n NUM abstract numbers with at least n digits within names
-g PATTERN grep: only consider stmts that include this string
-h HOSTNAME hostname of db server for *-slow.log filename (can be wildcard),
default is ‘*’, i.e. match all
-i NAME name of server instance (if using mysql.server startup script)
-l don’t subtract lock time from total time

vi copy from line number to line number

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

vi copy from line number to line number

You can use split, or sed

Lets use command sed for example

in below given example we have start line number: 143 end line number 201 and file name: filter.log
output to file called outfile.log

# sed -n '143,201p' filter.log > outfile.log

other way to achieve copy:
Block selection VI

Using marker we can achieve that too.

Type

mk

to mark this spot as

k

.
Go to the end of the section you want.

Type: y’k (y= Yank, , k) To yank from the mark to the current location.

Now p will do your job

Also you could use d’k to cut/delete.

Powered by WordPress & Theme by Anders Norén