show global status が一気に表示されすぎて困るのでless使いたい、grepしたい、sqlの記録とかをログを残したい等を思ってたけど(mysqlに入る前にscript叩けばできるけど) mysql内で出来るの初めて知った。
mysql> \h (略) pager (\P) Set PAGER [to_pager]. Print the query results via PAGER. tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
mysql> pager grep -i cache mysql> show global status; | Binlog_cache_disk_use | 0 | | Binlog_cache_use | 0 | | Binlog_stmt_cache_disk_use | 0 | | Binlog_stmt_cache_use | 0 | | Com_assign_to_keycache | 0 | | Qcache_free_blocks | 0 | | Qcache_free_memory | 0 | | Qcache_hits | 0 | | Qcache_inserts | 0 | | Qcache_lowmem_prunes | 0 | | Qcache_not_cached | 0 | | Qcache_queries_in_cache | 0 | | Qcache_total_blocks | 0 | | Ssl_callback_cache_hits | 0 | | Ssl_session_cache_hits | 0 | | Ssl_session_cache_misses | 0 | | Ssl_session_cache_mode | NONE | | Ssl_session_cache_overflows | 0 | | Ssl_session_cache_size | 0 | | Ssl_session_cache_timeouts | 0 | | Ssl_used_session_cache_entries | 0 | | Threads_cached | 0 |
うっひょー、これめっちゃいいやん。