June 20, 2013

Comment: Fun with the MySQL pager command

… follows: mysql> pager grep -v ‘\-\+\-’ | grep -v ” Id[ |]*User ” | awk -F ‘|’ ‘{print $6}’ | sort | uniq -c | sort -r PAGER set to ‘grep -v ‘\-\+\-’ | grep -v ” Id…

Post: Fun with the MySQL pager command

… your custom pager, this is easy, just run pager: mysql> pager Default pager wasn’t set, using stdout. Or \n: mysql> \n PAGER set to stdout But the pager command is… probably not the best solution. With pager, it is straightforward: mysql> pager grep Sleep | wc -l PAGER set to ‘grep Sleep | wc -l’ mysql> show…

Post: Be productive with the MySQL command line

… annoying but it is easily solved by using the pager command: mysql> pager more PAGER set to ‘more’ mysql> select title from sakila… (which can be huge), you can call pager to the rescue: mysql> pager grep sequence PAGER set to ‘grep sequence’ mysql> show engine innodb status\Gselect… want to disable paging, you can simply run: mysql> pager Default pager wasn’t set, using stdout. Using edit When you try…

Post: Neat tricks for the MySQL command-line pager

…/sh grep -A 1 ‘TRX HAS BEEN WAITING’ Now in your mysql session, set /tmp/lock_waits as your pager and let’s see if there are any lock waits: mysql> pager /tmp/lock_waits PAGER set to ‘/tmp/lock_waits’ mysql> show innodb… sort of goodies can we think of here? mysql> pager mk-visual-explain PAGER set to ‘mk-visual-explain’ mysql> explain select…

Post: How to calculate a good InnoDB log file size

… queries at your server’s peak usage time: mysql> pager grep sequence PAGER set to ‘grep sequence’ mysql> show engine innodb status\G select sleep…

Comment: Neat tricks for the MySQL command-line pager

… OS though. You could do similar on MySQL on Windows. pager grep -v “Sleep” |sort -n -t “|” -k 7 |tail show processlist…

Comment: Neat tricks for the MySQL command-line pager

…=100 # find the last ^mysql> lastcmd=$(tail -n $goback $teefile | grep “^mysql> “|tail -1| awk -F”mysql> ” ‘{print $2}’|sed -e… with bash in 10 minutes. Would be nice if the pager could be passed args like “last command” but this is…