Skip to content

Instantly share code, notes, and snippets.

mysql> SELECT * FROM t1;
+-----+-----------------------+--------------+
| num | val | comment |
+-----+-----------------------+--------------+
| 1 | はは | mother |
| 2 | まるこ・ぽーろ | dummy |
| 3 | ババ | grand mother |
| 4 | パパ | daddy |
+-----+-----------------------+--------------+
4 rows in set (0.00 sec)
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
use Time::HiRes;
use Parallel::ForkManager;
my $dsn= "dbi:mysql:d1;mysql_socket=/tmp/mysql.sock";
my $pm = Parallel::ForkManager->new(10);
mysql> show global status like 'qcache%';
+-------------------------+-----------+
| Variable_name | Value |
+-------------------------+-----------+
| Qcache_free_blocks | 151863 |
| Qcache_free_memory | 539734064 |
| Qcache_hits | 112973 |
| Qcache_inserts | 32082543 |
| Qcache_lowmem_prunes | 30918205 |
| Qcache_not_cached | 3304245 |
mysql> SELECT * FROM setup_instruments WHERE name LIKE '%query%cache%';
+------------------------------------------------------------+---------+-------+
| NAME | ENABLED | TIMED |
+------------------------------------------------------------+---------+-------+
| wait/synch/mutex/sql/Query_cache::structure_guard_mutex | NO | NO |
| wait/synch/rwlock/sql/Query_cache_query::lock | NO | NO |
| wait/synch/cond/sql/Query_cache::COND_cache_status_changed | NO | NO |
| stage/sql/checking query cache for query | NO | NO |
| stage/sql/invalidating query cache entries (table) | NO | NO |
| stage/sql/invalidating query cache entries (table list) | NO | NO |
$ history | awk '{ print $2 }' | sort | uniq -c | sort -nr | head | awk '{ print $2 }' | cat -n
1 d
2 vim
3 ll
4 cd
5 perl
6 git
7 ssh
8 ps
9 ./my_logstash.pl
@yoku0825
yoku0825 / gist:a89932c6a1491fcb758c
Created April 2, 2015 00:54
from mysql-5.7.6-m16/storage/innobase/buf/buf0flu.cc
2942 #ifdef UNIV_LINUX
2943 /* linux might be able to set different setting for each thread.
2944 worth to try to set high priority for page cleaner threads */
2945 if (buf_flush_page_cleaner_set_priority(
2946 buf_flush_page_cleaner_priority)) {
2947
2948 ib::info() << "page_cleaner coordinator priority: "
2949 << buf_flush_page_cleaner_priority;
2950 } else {
2951 ib::info() << "If the mysqld execution user is authorized,"
mysql56> status
--------------
/usr/mysql/5.6.23/bin/mysql Ver 14.14 Distrib 5.6.23, for Linux (x86_64) using EditLine wrapper
Connection id: 4
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
@yoku0825
yoku0825 / init
Last active August 29, 2015 14:18
$ perl -e 'for ($n= 1; $n <= 1000000; $n++) {printf("%d\n", $n);}' > /tmp/seq
$ mysql
mysql56> SELECT @@version;
+------------+
| @@version |
+------------+
| 5.6.24-log |
+------------+
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (num int, val varchar(32), PRIMARY KEY(num), FULLTEXT KEY(val)) Engine= Mroonga;
INSERT INTO t1 VALUES (1, 'one');
SELECT * FROM t1 WHERE match(val) against('one') ORDER BY val, val; # This doesn't crash.
SELECT * FROM t1 WHERE match(val) against('one') ORDER BY val, val LIMIT 1; # This doesn't crash.
mysql56> SET @a = 0;
Query OK, 0 rows affected (0.00 sec)
mysql56> SELECT num, val, @a:= @a+1 FROM t1 WHERE num < 100 ORDER BY val LIMIT 30;
+-----+----------------------------------+-----------+
| num | val | @a:= @a+1 |
+-----+----------------------------------+-----------+
| 27 | 02e74f10e0327ad868d138f2b4fdd6f0 | 1 |
| 63 | 03afdbd66e7929b125f8597834fa83a4 | 2 |
| 60 | 072b030ba126b2f4b2374f342be9ed44 | 3 |