Skip to content

Instantly share code, notes, and snippets.

View hironomiu's full-sized avatar
🍕
🍔 🍔 🍔 🍔

hironomiu hironomiu

🍕
🍔 🍔 🍔 🍔
View GitHub Profile
@hironomiu
hironomiu / gist:8019721
Last active December 31, 2015 17:19
レプリケーション

レプリケーション

事前準備 PORTの解放確認

3306が解放されていない場合以下を実施

# vi /etc/sysconfig/iptables
+ -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
# service iptables restart
@hironomiu
hironomiu / gist:8295933
Last active January 2, 2016 11:19
トランザクション

トランザクション

準備

  • ターミナルは二つ起動すること以後ターミナルA、ターミナルBと呼ぶ
  • master,slave構成の場合はmasterのみで作業を行います

ターミナルA

# mysql

mysql> use test
@hironomiu
hironomiu / gist:8418671
Last active March 2, 2020 14:58
パフォーマンスチューニング

パフォーマンスチューニング

スロークエリ

設定確認

# mysql
mysql> show global variables like '%slow_query%';
+---------------------+-------------------------------+
| Variable_name       | Value                         |
+---------------------+-------------------------------+
| slow_query_log      | ON                            |
@hironomiu
hironomiu / gist:4f23da6be771be5b5afa
Last active August 29, 2015 14:02
ネクストキーロックの検証

ネクストキーロックの検証

準備

テーブルの作成

create table test_next_key_lock (
id int(8) not null AUTO_INCREMENT,
col1 char(1) not null,
col2 int(8),
rec_date datetime,
PRIMARY KEY (id),
@hironomiu
hironomiu / gist:efe2b42fdc284d663239
Last active August 29, 2015 14:13
JSじゃんけん 事前準備

JSじゃんけん 事前準備

必須とついているものは必ず準備しましょう

テキストエディタ(必須)

GitHubアカウント(必須)

  • アカウントの無い人はGitHub公式にてアカウントを取得しましょう
@hironomiu
hironomiu / gist:18e67de38341a16e7f08
Created January 22, 2015 01:33
SQLアンチパターン:1章ジェイウォーク

1章 ジェイウォーク

準備

create database chapter1;
use chapter1;

1.1 目的:複数の値を持つ属性を格納する

テーブルの作成、サンプルデータの挿入

@hironomiu
hironomiu / gist:6e8cf7af96ba9776e136
Created February 5, 2015 01:33
SQLアンチパターン:5章EAV(エンティティ・アトリビュート・バリュー)
# 5章 EAV(エンティティ・アトリビュート・バリュー)
## intro
```
SELECT date_reported, COUNT(*)
FROM Bugs
GROUP BY date_reported;
```
## 5.2 アンチパターン:汎用的な属性テーブルを使用する
@hironomiu
hironomiu / gist:18ed8a3205110fe52852
Created February 12, 2015 00:32
SQLアンチパターン:6章ポリモーフィック関連

6章 ポリモーフィック関連

準備

create database chapter6;
user chapter6;

6.2.2 ポリモーフィック関連へのクエリ実行

準備

@hironomiu
hironomiu / gist:f4643e5d679cea1f4f72
Created March 5, 2015 01:53
SQLアンチパターン:14章アンビギュアスグループ(曖昧なグループ)

14章 アンビギュアスグループ(曖昧なグループ)

準備

drop table Bugs;

CREATE TABLE `Bugs` (
      `bug_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
      `reported_by` int,
      `date_reported` date,
@hironomiu
hironomiu / gist:fa80b622538412580ee4
Last active August 29, 2015 14:27
Treasure2015:日報

日報

Treasure期間中、みなさんは毎日、日報を書きます。後半戦ではチーム開発する際に日報で行っている 「issue -> branch -> 開発 -> push -> pull request」 の開発サイクルで全員開発するので日報で、このサイクルに慣れましょう!

Step0 準備

$ cd ~/Treasure2015/daily_report
$ git checkout master