June 19, 2013

Comment: Fun with the MySQL pager command

… as 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[ |]*User ” | awk -F ‘|’ ‘{print $6}’ | sort | uniq -c | sort -r’ mysql> show processlist…

Comment: SimCity outages, traffic control and Thread Pool for MySQL

… — so generally the solution I presented to clients was a MySQL connection pool handling system for the application level via a… aim to show just how far things have come with MySQL clustering performance: http://themattreid.com/wordpress/2013/03/01/building… explaining how it all works) As an aside, setting the pager to ‘less’ is a useful bit when running show processlist…

Post: Fun with the MySQL pager command

… 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… result is possible with pager: mysql> pager cat > /dev/null PAGER set to ‘cat > /dev/null’ # Trying an execution plan mysql> SELECT … 1000 rows in…

Post: Be productive with the MySQL command line

… but it is easily solved by using the pager command: mysql> pager more PAGER set to ‘more’ mysql> select title from sakila.film; +—————————–+ | title | +—————————–+ | ACADEMY… 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 sleep…

Post: How to convert MySQL's SHOW PROFILES into a real profile

… with the Sakila sample database to demonstrate: mysql> SET profiling=1; mysql> pager cat > /dev/null mysql> SELECT * FROM nicer_but_slower_film_list… query consumed 0.18 seconds. Where did the time go? mysql> SHOW PROFILE FOR QUERY 1; +———————-+———-+ | Status | Duration | +———————-+———-+ | starting | 0.000032…

Post: Neat tricks for the MySQL command-line pager

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… goodies can we think of here? mysql> pager mk-visual-explain PAGER set to ‘mk-visual-explain’ mysql> explain select * from sakila.film inner…

Comment: Neat tricks for the MySQL command-line pager

… to the tee file AFTER the pager has completed (and to .mysql_history only after you exit mysql), so getting the last command…) # But only ever save one :) open (PAGER_LOG, ‘>/tmp/mysql_pager.log’); print PAGER_LOG “$out\n”; close (PAGER_LOG); # See if it an EXPLAIN eval { local $SIG{‘__WARN__’}; system(‘/usr/local/bin/mk-visual-explain /tmp/mysql_pager.log…

Comment: Fun with the MySQL pager command

pager md5sum doesn’t seem to work properly e.g. mysql> pager md5sum PAGER set to ‘md5sum’ mysql> select pkCaseId from tblCase where pkCaseId=1; e8f6937bca3138aa2d09439a0450a146 – 1 row in set (0.01 sec) mysql> select…

Comment: Neat tricks for the MySQL command-line pager

Cool tricks. My most frequent usage of “pager” is “vim -” and then manipulate the output at will. I … ‘$i+= $F[17];END{print $i}’ mysql> pager ./index_size.sh PAGER set to ‘./index_size.sh’ mysql> show table status; 71680 mysql> nopager Giuseppe

Comment: Solving INFORMATION_SCHEMA slowness

… in set (0.11 sec) mysql> pager sort -n -t’|’ -k3 PAGER set to ‘sort -n -t’|’ -k3′ mysql> show profile for query 12… tables | 0.396198 | 276 rows in set (0.00 sec) mysql> show profile for query 14; +———————-+———-+ +———————-+———-+ +———————-+———-+ | Status | Duration | | removing tmp table…