2013/11/01

Mysql variables

★表示
mysql --help =>変数を表示する
show status like '%?%'; 状態?
show global status
show session status
 =>flush status

show variables like '%?%'; パラメータ

show create table ***; テーブル作成情報
select @@tx_isolation; 



・skip-external-locking=>外部ログ
・skip-name-reslove--->DNS解析を行わない。接続はIPアドレスを使う。その分早くなる
・thread_concurrency->廃止されたみたい。innodb_thread_concurrencyというオプションがある
 This variable is specific to Solaris 8 and earlier systems
 Current Solaris versions document this as having no effect.
・long_query_time--->これ以上はSLOW QUERYだ。。
・sync_binlog==>bin-logの同期化の動作間隔(0はOSに任せる)。動作(per statement if autocommit is enabled, and one write per transaction otherwise)
・back_log=>接続はいっぱいになる時、Mysql処理できる接続数(スタックに入れる)
・key_buffer_size==>index
・sort_buffer_size=>接続ごとの数値

★新しいコネクションを作る。
新しいコネクションはセットであり、新たなMYSQLObject(join_buffer,sort_buffer,session変数配列)

・innodb_data_file_path=ibdata1:10M;ibdata2:1G:autoextend(最後だけ利用できる)
=>ibdata1 固定サイズ10M
 autoextend:デフォルトで、インクリメントは一回に付き8MB となっています。それは innodb_autoextend_increment システム変数を変更する事で修正できます
 max:500M=>最大500MB まで大きくなる事を許容します:

・innodb_flush_log_at_trx_commit
 0に設定された時は、ログ バッファは1秒に一回ログ ファイルに書き込まれ、ディスク操作へのフラッシュはログ ファイル上で行わ、トランザクション コミットの際には何も行われません
==>一番早い、一番危ない。
 1(デフォルト)の時は、ログファイルは各トランザクション コミットの時にログ ファイルに書き込まれ、ディスク操作へのフラッシュはログ ファイル上で行われる
・innodb_lock_wait_timeout:トランザクションがロール バックされる前に、ロックを待つ秒数でのタイムアウト。デフォルトは50秒



・innodb_autoextend_increment
The increment size (in MB) for extending the size of an auto-extending shared tablespace file when it becomes full. The default value is 8. This variable does not affect the per-table tablespace files that are created if you use innodb_file_per_table=1. Those files are auto-extending regardless of the value of innodb_autoextend_increment. The initial extensions are by small amounts, after which extensions occur in increments of 4MB.



・innodb_file_per_table
If innodb_file_per_table is disabled (the default), InnoDB creates tables in the shared tablespace. If innodb_file_per_table is enabled, InnoDB creates each new table using its own .ibd file for storing data and indexes, rather than in the shared tablespace. See Section 14.2.1.1, “Using Per-Table Tablespaces” for more information including advantages and disadvantages of using per-table tablespaces.
===>これ。"innodb_file_per_table=1" これを設定すると、MySQLはInnoDBのバイナリーファイルをテーブル毎に分割してくれます。これを使えば必要なテーブルのファイルにアクセスするだけで済み、ディスクのI/O負荷も低減します。つまるところ、速度の向上が見込めるわけです。


・utf8_general_ci
また文字セット毎に照合順序が用意されています。照合順序というのは複数の値を比較する時に、どのように比較するのかを定義しているもので各文字セットにデフォルトで設定されている照合順序は「Default collation」列に記載されています。例えば「utf8」のデフォルト照合順序は「utf8_general_ci」です。