MySQL :: MySQL 5.6 Reference Manual :: 22 MySQL
Performance Schema
5.6以降「よくなったよ!」「確かにね!
でもメモリー」「」みたいな感じで扱われて結局まだONにしているインスタンスの少ないPerformance
Schemaなのでちょっと練習中。
tpcc-mysqlとかでやると割と綺麗なクエリーをしているので面白い情報が出ない(ibdata1のfsyncに時間がかかってることなんて知ってるよ!
って感じになる)ので、isucon2のアプリで試してみることにしますた。モリスさん++
livedoor Techブログ : 自家製 #isucon2 のつくりかた
…
MySQL5.7.6DMRが今月リリースされて、色々な機能追加や改善が施されているので、
DMRのうちに少しずつ検証してRCとGAに備えたいと思います。
とりあえず、本日は初期設定まで。
MySQL 5.7 Release Notes
http://dev.mysql.com/doc/relnotes/mysql/5.7/en/index.html
ダウンロードサイトからDMRをダウンロードしてきてあります。
mysql-5.7.6-m16-linux-glibc2.5-x86_64.tar.gz
[root@misc01 admin]# cd /usr/local/ [root@misc01 local]# ls -l 合計 545048 drwxr-xr-x. 2 root root 6 6月 10 2014 bin drwxr-xr-x. 2 root root 6 6月 10 2014 etc drwxr-xr-x. 2 root root …[さらに読む]
FLUSH TABLES WITH READ LOCKをバックグラウンドで実行する処理がある場合に、
長時間実行しているバッチなどの処理があると、後から実行されるQueryが待たされるケースがある。
そんな、話を多からず、少なからず質問頂くので一応メモとして動作を記録。
通常は、データベース側の処理はDurationは短いので問題無いですが。。。
長時間バッチが実行されるような処理がある場合を避けて、FLUSH TABLES WITH READ
LOCKを含む処理を実行するのが良さそうです。
MyISAMが全て無くなればまた、少しだけ選択肢が増えそうです。
…
[さらに読む]
As of MySQL 5.7.2, it is possible to define multiple triggers for
a given table that have the same trigger event and action time.
For example, you cannot have two BEFORE UPDATE triggers for a
table. By default, triggers that have the same trigger event and
action time activate in the order they were created. To affect
trigger order, specify a trigger_order clause that indicates
FOLLOWS or PRECEDES and the name of an existing trigger that also
has the same trigger event and action time. With FOLLOWS, the new
trigger activates after the existing trigger. With PRECEDES, the
new trigger activates before the existing trigger.MySQL :: MySQL 5.7 Reference Manual :: 13.1.16 CREATE
TRIGGER Syntax
試してみよう。
5.6のフツーの動作は
mysql56> CREATE TRIGGER before_insert_1 BEFORE INSERT ON t1 …[さらに読む]
日々の覚書: InnoDB
Monitorの仲間たち(InnoDBエンジン本体のアレ) で"CREATE TABLE
innodb_monitor .."的なものを紹介しました。あれから2年。
というかよく調べてみたら1年前。
MySQL :: MySQL 5.7 Release Notes :: Changes in
MySQL 5.7.4 (2014-03-31, Milestone 14)
InnoDB: New global configuration parameters, innodb_status_output
and innodb_status_output_locks, allow you to dynamically enable
and disable the standard InnoDB Monitor and InnoDB Lock Monitor
for periodic output. Previously, enabling and disabling these
monitors for periodic output required creating and dropping
specially named tables (innodb_monitor and innodb_lock_monitor).
For additional information, see …
MySQL 5.7.6-m16で導入されたgenerated
columnについてメモ。タイトルでしゃらっと関数インデックスとか言っているけれど、俺はその機能を知らない。
MySQL :: MySQL 5.7 Reference Manual :: 13.1.14
CREATE TABLE Syntax
generated
columnはあるカラムの値に関数を噛ませた結果をカラムとして実体化できたり、実体化せずに毎回計算できたりするカラム定義のことらしくて、
mysql57> CREATE TABLE t1 (num int, val varchar(32)) Engine = MyISAM;[さらに読む]
Query OK, 0 rows affected (0.01 sec)
mysql57> INSERT INTO t1 SET num = 1, val = 'one';
Query OK, 1 row affected (0.00 sec)
mysql57> SELECT * FROM t1;
+-----+------+
| num | val |
+-----+------+
| 1 | …
MySQL SlapをNDB対して実行して、メモリー割り当て変化の簡単な確認
[root@misc bin]# /usr/local/mysql/bin/mysqlslap --no-defaults --create-schema=SLAP --engine=ndb --auto-generate-sql --auto-generate-sql-add-autoincrement --engine=ndb --number-int-cols=3 --number-char-cols=5 --concurrency=10 --auto-generate-sql-write-number=10000 --auto-generate-sql-execute-number=10000 --auto-generate-sql-load-type=mixed -h 192.168.56.114 -u admin -p
Enter password:
Benchmark
Running for engine ndb
Average number of seconds to run all queries: 135.323 seconds
Minimum number of seconds to run all queries: 135.323 seconds
Maximum number of seconds to run all queries: 135.323 seconds
Number of clients running queries: 10
Average number of queries per client: 10000
[root@misc bin]#
Node, …
[さらに読む]
日々の覚書: MySQL
5.7.6は--secure-file-privを設定してないとWarningを吐くようになった のちょっと続き。
--secure-file-priv
そのものについては↑の記事を読んでいただけると幸い。LOAD DATA INFILEやSELECT .. INTO
OUTFILEの動きを制限する。
ドキュメントのsysvarのところに書いてある けれど、
* -DINSTALL_LAYOUT=STANDALONE, WIN でビルドされた場合は暗黙のデフォルトなし
* -DINSTALL_LAYOUT=DEB, RPM, SLES, SVR4
でビルドされた場合は"/var/lib/mysql-files" …
今回は、検証用に2台のノードにMySQL Clusterを導入してみました。
検証目的なので2台で設定してますが、本番ではデータノードは分けた方が良さそうです。
————————-
Node1: 192.168.56.114
Node2: 192.168.56.115
————————-
mysql> select * from ndbinfo.nodes; +---------+--------+---------+-------------+-------------------+ | node_id | uptime | status | start_phase | config_generation | +---------+--------+---------+-------------+-------------------+ | 1 | 3994 | STARTED | 0 | 1 | | 2 | 3948 | STARTED | 0 | 1 | +---------+--------+---------+-------------+-------------------+ 2 rows in set (0.05 sec) mysql> mysql> select * from ndbinfo.arbitrator_validity_detail; +---------+------------+------------------+---------------+-----------+ | node_id | arbitrator | arb_ticket …[さらに読む]
MySQL 監査ログのローテション
MySQL Enterprise Auditで取得した監査ログをMySQL Utilitiesを利用して、
定期的にローテーション出来るかどうか確認してみました。
Audit Logのローテーションとしては、以下の2パターンがあります。
1) ログサイズによる自動ローテーション
sysvar_audit_log_rotate_on_size
If the audit_log_rotate_on_size value is greater than 0,
the audit log plugin closes and reopens its log file
if a write to the file causes its size to exceed this value.
2) …
[さらに読む]