SlideShare a Scribd company logo
Transactd
高速・高機能なNoSQLプラグイン
ビズステーション株式会社 矢口 尚
1
矢口 尚 (Hisashi Yaguchi)
ビズステーション株式会社 代表取締役社長
所在地 :長野県松本市井川城
主な事業:販売管理・財務会計ソフト開発販売
(主にSnap-on用)
システムコンサルティング
言語 :C++好き Java(Android) PHP Ruby
http://www.bizstation.jp
Twitter @bizstationcorp
自己紹介
2
トランザクトディーって何だ?
Transactd
3
Transactdとは?
MySQLで
Indexed Sequential Access
Method
を使えるようにする
(MyISAMじゃないです)
4
大雑把にいうと
ISAM?
SQLレイヤーをとばしてHandlerレイヤーを直接操作
Handlerの基本メソッドはISAM
5
予備知識 ISAM (1)
Indexed Sequential Access
6
ISAM: Indexed Sequential Access Method
インデックス順にアクセスする方式
MySQLの内部はISAMで処理している
→ MySQLを使う上でも大切な基礎
でも案外知らない人も多い
昔はみんな使っていたけど、今はSQLで隠蔽されている
予備知識 ISAM (2)
インデックスとアクセス
7
id name group
1 akio 3
2 yoko 1
3 naoko 2
4 takeshi 1
先頭 seekFirst
最後 seekLast
前後
seekNext (++)
seekPrev (--)
キー値 seekEqual (=)
キー値の前後
seekLessThan (<=)
seekGreater (>=)
アクセスメソッド
(カーソルの移動と読取)
• これで全データにアクセス可能
• カレント行(カーソル)が重要
• 更新はカレント行に対して行う
id 列の順に並んだ表 → id 列の Index
group 列 〃 → group 列の Index
MySQL内部でも同じ方法でアクセスしている
予備知識 ISAM (3)
基本アクセスコード
8
tb->setKeyNum(0); // 1
tb->seekFirst(); // 2
while(tb->stat() == 0) { // 3
if (tb->getFVint(“id”) <= 3)
// 4
break;
if (isMatch(xxx)) { // 5
// ここで何かする // 6
}
tb->seekNext(); // 7
} // 8
1. Indexを決める
2. 検索開始(位置指定)
3. アクセスできたか?
4. 範囲外ではないか?
5. 条件にマッチするか?
6. 何かする
7. 次に進む
8. 3に戻る
// groupを2に更新する
tb->setFV("group", 2);
tb->update();
// 検索開始位置を表の途中にする場合
tb->setFV(“id", 3);
tb->seekGreater();
SQLではなくプログラミング言語でデータを操作する
理解できるとこんなことがわかる
9
例
• Indexはid列の主キーのみ
• REPEATABLE-READ
• データは表の通り
Q: 以下のSQLはどのレコードをロックするか?
START TRANSACTION;
SELECT * FROM user WHERE group = 1 FOR UPDATE;
予備知識 ISAM (4)
id name group
1 akio 3
2 yoko 1
3 naoko 2
4 takeshi 1
理解できるとこんなことがわかる
10
A: 全レコード
• group 列順の indexがない
→ primary-keyでアクセス
• group = 1 のレコードがどこにあるかわからない
→ 先頭から最後まで検索(途中で中止できない)
→ 全レコードにアクセスすることになる
• REPEATEBLE-READ は
読み取ったレコードのロックを解放しない
ブログを見てね MySQL/MariaDBとTransactdのInnoDBロック制御詳細
http://bizstation.hatenablog.com/entry/2014/12/24/103641
予備知識 ISAM (5)
id name group
1 akio 3
2 yoko 1
3 naoko 2
4 takeshi 1
まとめ
11
ISAMを理解するとロック範囲や
パフォーマンスが理解できる
=SQLが上手く使えるようになる
→ Transactdを使えるようになると
SQLも上手く使えるようになる!
予備知識 ISAM (6)
の話に戻ります
Transactd
12
Transactdとは?
MySQLで
Indexed Sequential Access Method
を使えるようにする
(MyISAMじゃないです)
SQLレイヤーをとばしてHandlerレイヤーを直接操作
Handlerの基本メソッドはISAM
13
大雑把にいうと
Transactdとは?
クライアント
Transactd Client
サーバー側
Transactd Plugin
しくみ
14
MySQL
Server
Storage Engines (InnoDB)
SQL Layer
Handler Interface
Transactd Plugin
App MySQL ClientTransactd Client
ほぼISAM
Transactdとは?
その他にも
15
• Insert/Update/Delete
• 条件によるマルチレコード取得
• バルクインサート
• トランザクション
• スナップショット
• ロック制御
• DDL処理
• レプリケーション制御
• HAコントロール
よいところ (1)
SQLとの比較(解析、実行方法)
自在なアクセスとムダの省略
16
SQL Transactd
SQL文の組立て 必要 不要
SQL文の解析 必要 不要
実行方法の計画 動的に決定 静的にプログラムで決定
実行 汎用的な処理
処理に最適化した
アルゴリズムを作成可能
よいところ (2)
ベンチマーク
http://bizstation.hatenablog.com/entry/2015/05/01/094233
MySQL5.7で
117万QPS!
詳しくは上記ブログで
高速
17
よいところ (3)
18
ミッションクリティカル
• レコード単位のアクセス
• シングルレコードロック
/マルチレコードロック
• アンロック
ロック範囲をコントロールして
同時実効性の高いアプリの作成が可能
(しかも簡単!)
よいところ (4)
 Join, OuterJoin
 OrderBy, GroupBy, Union
 Limit, Skip
 NULL?
Transactdだけでアプリ全体の開発が可能
SQLライクな高機能クエリ
19
$at = new ActiveTable($db, 'users');
$at->index(1)->keyValue(0)->alias('name', 'user_name');
$q = new Query();
$q->select('id', 'user_name', 'group', 'tel')
->where('group', '<=', 2)->reject(1);
$rs = $at->read($q);
SQLと共存できます!
20
Transactd
• プログラミング言語からのデータアクセス
→ APIの方が高速で制御しやすいことが多い
• サーバー負荷の低減
サーバーで計算(パース、ソート、Join)がない
• パフォーマンスの向上
SQL
• ネットワークレイテンシが大きい場合
→ サーバー側で結果を出すSQLが有利
• サンプル集計などはSQLが手軽
おすすめの使い方
こんな方におすすめ
21
おすすめの使い方
• 「速!」と感じるアプリケーションを
作りたい
• DBサーバー数を減らしたい
• レコードロックがうまくできているか
イマイチ不安
• パフォーマンスが読めるようになりたい
(読取アクセス数やロックの想像)
• 日頃からSQLは冗長だと感じている
プチ・
チュートリアル
22
インストール
23
初めの一歩
ダウンロード
http://www.bizstation.jp/al/transactd/download/
• サーバープラグイン
• クライアントライブラリ
• Linux, Windows, Mac OS X
• C/C++, PHP, Ruby, COM
インストールガイド
http://www.bizstation.jp/ja/transactd/documents/install_guide.html
テーブル準備は?
24
SQLで作成したテーブルをそのまま開ける
 既存のデータは変更不要 .
 スキーマ情報は自動取得 .
準備は必要なし!
(※BLOBのJSONとGEOMETRYを除く)
初めの一歩
詳しいドキュメント
25
http://www.bizstation.jp/ja/transactd/documents/tutorial.html
初めの一歩
Transactd チュートリアル
日本語版、英語版
C++/PHP/Ruby/C#/JScript
その他
最新情報 など
26
最新情報 (1)
バージョン 3.7.2
27
最新版(3.x)の機能
• MySQL 5.5/5.6/5.7 対応
• MariaDB 5.5/10.0/10.1 対応
• NULLフィールド
• スキーマテーブルレス
• MySQL Native passwordでの共通認証
• High Availability(高可用運用)
• レプリケーション制御
最新情報 (2)
PHP最速ORM (たぶん)
28
Transactd PHP ORM
モデルの取得速度
• PDOの2倍
• Laravel 5.3の5倍以上
Framework依存なし
詳細は (“PDO 高速 ORM” 🔍)
http://bizstation.hatenablog.com/entry/2017/01/12/092540
100モデルの取得にかかる時間
最新情報 (3)
Transactd Studio (予定)
29
データベース管理ツール
Transactd Studio
実績
実績
30
当社の実績
• 常時 約 500クライアント・10サーバーが稼働
その他
募集
Transactdに興味のある方
31
是非一緒に使っていきましょう!
お気軽にご連絡ください。
GitHub https://github.com/bizstation/transactd
Twitter @bizstationcorp
Facebook
(はじめたばかり)
https://www.facebook.com/bizstation
はてなブログ http://bizstation.hatenablog.com
ご清聴ありがとう
ございました。
Transactd
http://www.bizstation.jp/ja/transactd
インストールガイド
http://www.bizstation.jp/ja/transactd/documents/install_guide.html
チュートリアル
http://www.bizstation.jp/ja/transactd/documents/tutorial.html
32
導入方法
C++/PHP/Ruby/C#/JScript対応

More Related Content

Featured (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
 

Transactd 高速・高機能なNoSQLプラグイン