SlideShare una empresa de Scribd logo
1 de 20
Descargar para leer sin conexión
1
MySQLの限界に挑戦する(?!)
MySQL Casual Talks vol.10
2017-02-01 19:10 LT
@meijik
免責事項
• 本プレゼンテーションにおいて示されている
見解は、私自身の見解であって、私の所属す
る会社・団体の見解を必ずしも反映したもの
ではありません。ご了承ください。
2
3
MySQLの限界
• よいこのみんなはこれを見てるよね!
• 限界までMySQLを使い尽くす!!(漢のコンピュータ道)
– http://nippondanji.blogspot.jp/2009/05/mysql.html
• 今回のLTはそれを順に見ていこうとしました
が、結果は。。。。
4
SQL文の最大長
• 限界までMySQLを使い尽くす!!(漢のコン
ピュータ道)によると。。。。
– MySQLサーバーが実行出来るSQL文の最大長
は、max_allowed_packetシステム変数で表され
る。max_allowed_packetの最大値は1GBであ
る。max_allowed_packetの値はセッションごとに
も設定可能なので、デフォルトではそこそこの値
(16MBなど)に設定しておいて、必要に応じて大
きな対を使うと良いだろう。
– デフォルト値は5.6より前は1MB, 5.6以降4MB
5
無意味なクエリでトライ!
UNION ALLで一連の値を返すクエリを作成。
↓こんな感じ
select repeat(' union all select "b"',4000) into
@a;
set @a= concat('select "a" ', @a);
prepare stmt1 from @a;
execute stmt1;
deallocate prepare stmt1;
6
できたクエリ
• select "a" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union allselect "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
7
できたクエリ(一部拡大)
• select "a" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union allselect "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select
"b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all
select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union
all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
select “a” union all select “b” union all select “b” …
8
さて実行!
mysql> select repeat(' union all select "b"',4000)
into @a;
Query OK, 1 row affected (0.00 sec)
mysql> set @a= concat('select "a" ', @a);
Query OK, 0 rows affected (0.00 sec)
mysql> prepare stmt1 from @a;
ERROR 1436 (HY000): Thread stack overrun:
246184 bytes used of a 262144 byte stack, and
16000 bytes needed. Use 'mysqld --
thread_stack=#' to specify a bigger stack.
9
スタック不足
• thread_stack
– https://dev.mysql.com/doc/refman/5.6/ja/serve
r-system-variables.html#sysvar_thread_stack
• 各スレッドのスタックサイズ。デフォルトの
256KBは、通常の操作では十分な大きさです。
スレッドスタックサイズが小さすぎるとサーバ
で処理できる SQL ステートメントの複雑さ、
ストアドプロシージャーの再帰の深さなど、メ
モリーを大量に消費する処理が制限されます。
10
じゃ2倍の512KBで
• 成功!
• じゃreapeatも二倍の8000で!
mysql> prepare stmt1 from @a;
ERROR 1064 (42000): memory exhausted
near '"b" union all select "b"' at line 1
→失敗orz
11
ERROR 1064 (42000)
• 通常クエリが文法的に間違っているときによ
くでる。
• perror 1064
– MySQL error code 1064
(ER_PARSE_ERROR): %s near ‘%-.80s’ at
line %d
• ただ今回は文法的にはあっている(はず)で
キーワード(%s) が “memory exhausted “
12
ソースをfindstr
(windowsのgrepライクなコマンド)
• mysql-5.7.17¥sql>findstr /nsi
/c:"memory exhausted" *
• sql_hints.yy.cc:1362: yyoverflow (YY_("memory
exhausted"),
• sql_hints.yy.cc:2099: yyerror (thd, scanner, ret,
YY_("memory exhausted"));
• sql_yacc.cc:19899: yyoverflow (YY_("memory
exhausted"),
• sql_yacc.cc:41019: yyerror (&yylloc, YYTHD,
YY_("memory exhausted"));
13
構文解析と字句解析
• クエリの解析
– 字句解析
– 構文解析
• 構文的には正しい(無意味な)複雑なクエリを
構文解析していて、内部的に用意しておいた
メモリを使い果たしたらしい。。。
• 通常のプログラムでは構文解析にyacc, 字句
解析にlexを利用する。
– 拡張子.yyはyaccのソースファイル
14
bisonとflex
• クエリの解析
– 字句解析: lex -> GNU版がflex
– 構文解析: yacc -> GNU版がbison
15
MySQLの場合
• クエリの解析
– 字句解析: 自前で行っている
– 構文解析: BNFで記述したソースをGNU bisonに
てコンパイルして行っている。
• BNF(バッカス・ナウア記法)
• バッカス・ナウア記法(英: Backus-Naur
form)とは、文脈自由文法を定義するのに用
いられるメタ言語のことで、一般にBNFやBN
記法と略される。(wikipediaより引用)
16
SQL標準をBNFで
• 初期のSQLは書籍などでBNF(バッカス・ナウ
ア記法)の記述があった。
• 現在奇特な方がSQL-92, 99, 2003のBNFを
公開してなさる。(多分読みきれん)
– https://github.com/ronsavage/SQL
• これを使えば多分クエリの整形ツールをつ
くったり(多分できる)、RDBMSを作ったりする
ことができると思われます。(多分無理)
17
まとめ
• MySQLのクエリの最大長(max_allowed_packet)
• スタックに引っかかる場合→スタックサイズを
大きくして対応
• 構文解析でメモリを使い果たした場合→簡単
な対応なし(まぁほとんど起こらない)
• MySQLのビルドになぜbisonが必要なのか、
と@kumagiのツイートの意味が分かった。
宣伝: 書籍情報
• おうちで学べるデータベースのきほん
– DBの初心者はこちらをどうぞ。
– なぜか韓国語版が発売
• 入手方法
– じゃんけんで勝つ。
– もしくは、Amazonでポチる w。
18
19
THANK YOU
• ご清聴ありがとうございました。
• [fyi] yacc/lexの参考書籍
– 日本語
• lex&yaccプログラミング (オライリージャパン)
• Cコンパイラ設計―yacc/lexの応用
• yacc/lex―プログラムジェネレータon UNIX
– 英語
• flex&bison (O‘reilly)
– 比較的新しい(2009/08)本(@meijikは未見)
– SQLの例がある(らしい)
20
MySQLの限界にチョット挑戦した。
MySQL Casual Talks vol.10
2017-02-01 LT
@meijik

Más contenido relacionado

La actualidad más candente

Goのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考える
Goのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考えるGoのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考える
Goのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考える
pospome
 
Pythonの処理系はどのように実装され,どのように動いているのか? 我々はその実態を調査すべくアマゾンへと飛んだ.
Pythonの処理系はどのように実装され,どのように動いているのか? 我々はその実態を調査すべくアマゾンへと飛んだ.Pythonの処理系はどのように実装され,どのように動いているのか? 我々はその実態を調査すべくアマゾンへと飛んだ.
Pythonの処理系はどのように実装され,どのように動いているのか? 我々はその実態を調査すべくアマゾンへと飛んだ.
kiki utagawa
 

La actualidad más candente (20)

Where狙いのキー、order by狙いのキー
Where狙いのキー、order by狙いのキーWhere狙いのキー、order by狙いのキー
Where狙いのキー、order by狙いのキー
 
雑なMySQLパフォーマンスチューニング
雑なMySQLパフォーマンスチューニング雑なMySQLパフォーマンスチューニング
雑なMySQLパフォーマンスチューニング
 
やってはいけない空振りDelete
やってはいけない空振りDeleteやってはいけない空振りDelete
やってはいけない空振りDelete
 
外部キー制約に伴うロックの小話
外部キー制約に伴うロックの小話外部キー制約に伴うロックの小話
外部キー制約に伴うロックの小話
 
Linuxにて複数のコマンドを並列実行(同時実行数の制限付き)
Linuxにて複数のコマンドを並列実行(同時実行数の制限付き)Linuxにて複数のコマンドを並列実行(同時実行数の制限付き)
Linuxにて複数のコマンドを並列実行(同時実行数の制限付き)
 
ソーシャルゲームのためのデータベース設計
ソーシャルゲームのためのデータベース設計ソーシャルゲームのためのデータベース設計
ソーシャルゲームのためのデータベース設計
 
Javaのログ出力: 道具と考え方
Javaのログ出力: 道具と考え方Javaのログ出力: 道具と考え方
Javaのログ出力: 道具と考え方
 
Dockerfileを改善するためのBest Practice 2019年版
Dockerfileを改善するためのBest Practice 2019年版Dockerfileを改善するためのBest Practice 2019年版
Dockerfileを改善するためのBest Practice 2019年版
 
脆弱性スキャナVuls(応用編)
脆弱性スキャナVuls(応用編)脆弱性スキャナVuls(応用編)
脆弱性スキャナVuls(応用編)
 
AVX2時代の正規表現マッチング 〜半群でぐんぐん!〜
AVX2時代の正規表現マッチング 〜半群でぐんぐん!〜AVX2時代の正規表現マッチング 〜半群でぐんぐん!〜
AVX2時代の正規表現マッチング 〜半群でぐんぐん!〜
 
今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -
今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -
今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -
 
SPAセキュリティ入門~PHP Conference Japan 2021
SPAセキュリティ入門~PHP Conference Japan 2021SPAセキュリティ入門~PHP Conference Japan 2021
SPAセキュリティ入門~PHP Conference Japan 2021
 
ソーシャルゲーム案件におけるDB分割のPHP実装
ソーシャルゲーム案件におけるDB分割のPHP実装ソーシャルゲーム案件におけるDB分割のPHP実装
ソーシャルゲーム案件におけるDB分割のPHP実装
 
Goのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考える
Goのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考えるGoのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考える
Goのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考える
 
なぜデータモデリングが重要なのか?
なぜデータモデリングが重要なのか?なぜデータモデリングが重要なのか?
なぜデータモデリングが重要なのか?
 
AVX-512(フォーマット)詳解
AVX-512(フォーマット)詳解AVX-512(フォーマット)詳解
AVX-512(フォーマット)詳解
 
マルチテナントのアプリケーション実装〜実践編〜
マルチテナントのアプリケーション実装〜実践編〜マルチテナントのアプリケーション実装〜実践編〜
マルチテナントのアプリケーション実装〜実践編〜
 
Pythonの処理系はどのように実装され,どのように動いているのか? 我々はその実態を調査すべくアマゾンへと飛んだ.
Pythonの処理系はどのように実装され,どのように動いているのか? 我々はその実態を調査すべくアマゾンへと飛んだ.Pythonの処理系はどのように実装され,どのように動いているのか? 我々はその実態を調査すべくアマゾンへと飛んだ.
Pythonの処理系はどのように実装され,どのように動いているのか? 我々はその実態を調査すべくアマゾンへと飛んだ.
 
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
 
バイナリアンを目指して For a binaryen
バイナリアンを目指して For a binaryenバイナリアンを目指して For a binaryen
バイナリアンを目指して For a binaryen
 

Destacado

Gunosy go2015 06-02
Gunosy go2015 06-02Gunosy go2015 06-02
Gunosy go2015 06-02
Yuta Kashino
 
Reflectionのパフォーマンス
ReflectionのパフォーマンスReflectionのパフォーマンス
Reflectionのパフォーマンス
明 高橋
 

Destacado (13)

[Golang] Go言語でサービス作ってる話
[Golang] Go言語でサービス作ってる話[Golang] Go言語でサービス作ってる話
[Golang] Go言語でサービス作ってる話
 
20130824 Lightweight Language "Go" @LL matsuri
20130824 Lightweight Language "Go" @LL matsuri20130824 Lightweight Language "Go" @LL matsuri
20130824 Lightweight Language "Go" @LL matsuri
 
Gunosy go2015 06-02
Gunosy go2015 06-02Gunosy go2015 06-02
Gunosy go2015 06-02
 
Go言語によるwebアプリの作り方
Go言語によるwebアプリの作り方Go言語によるwebアプリの作り方
Go言語によるwebアプリの作り方
 
Chef localmodeをためした
Chef localmodeをためしたChef localmodeをためした
Chef localmodeをためした
 
SQL 脳から見た Ruby
SQL 脳から見た RubySQL 脳から見た Ruby
SQL 脳から見た Ruby
 
MySQLアンチパターン
MySQLアンチパターンMySQLアンチパターン
MySQLアンチパターン
 
MySQL 5.7の次のMySQL 8.0はどんなものになるだろう
MySQL 5.7の次のMySQL 8.0はどんなものになるだろうMySQL 5.7の次のMySQL 8.0はどんなものになるだろう
MySQL 5.7の次のMySQL 8.0はどんなものになるだろう
 
Reflectionのパフォーマンス
ReflectionのパフォーマンスReflectionのパフォーマンス
Reflectionのパフォーマンス
 
ペパボ de MySQL
ペパボ de MySQLペパボ de MySQL
ペパボ de MySQL
 
MySQL 5.7の次のMySQLは
MySQL 5.7の次のMySQLはMySQL 5.7の次のMySQLは
MySQL 5.7の次のMySQLは
 
MySQLerの7つ道具 plus
MySQLerの7つ道具 plusMySQLerの7つ道具 plus
MySQLerの7つ道具 plus
 
MySQL 8.0で憶えておいてほしいこと
MySQL 8.0で憶えておいてほしいことMySQL 8.0で憶えておいてほしいこと
MySQL 8.0で憶えておいてほしいこと
 

Más de Meiji Kimura (6)

My sql casual12lt
My sql casual12ltMy sql casual12lt
My sql casual12lt
 
オープンソースRDBMS新機能ランダウンOSC2017TokyoSpring
オープンソースRDBMS新機能ランダウンOSC2017TokyoSpringオープンソースRDBMS新機能ランダウンOSC2017TokyoSpring
オープンソースRDBMS新機能ランダウンOSC2017TokyoSpring
 
オープンソース・データベースの最新事情
オープンソース・データベースの最新事情オープンソース・データベースの最新事情
オープンソース・データベースの最新事情
 
My sql casual9lt_pub
My sql casual9lt_pubMy sql casual9lt_pub
My sql casual9lt_pub
 
NULLとの戦い RDBMS実装編
NULLとの戦い RDBMS実装編NULLとの戦い RDBMS実装編
NULLとの戦い RDBMS実装編
 
MySQLインストールのお作法
MySQLインストールのお作法MySQLインストールのお作法
MySQLインストールのお作法
 

Último

Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
amitlee9823
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
amitlee9823
 
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
amitlee9823
 
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
amitlee9823
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
MarinCaroMartnezBerg
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
amitlee9823
 
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 

Último (20)

April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
 
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
 
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
 
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics Program
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Predicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science ProjectPredicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science Project
 
Anomaly detection and data imputation within time series
Anomaly detection and data imputation within time seriesAnomaly detection and data imputation within time series
Anomaly detection and data imputation within time series
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
 

MySQLの限界に挑戦する

  • 1. 1 MySQLの限界に挑戦する(?!) MySQL Casual Talks vol.10 2017-02-01 19:10 LT @meijik
  • 3. 3 MySQLの限界 • よいこのみんなはこれを見てるよね! • 限界までMySQLを使い尽くす!!(漢のコンピュータ道) – http://nippondanji.blogspot.jp/2009/05/mysql.html • 今回のLTはそれを順に見ていこうとしました が、結果は。。。。
  • 5. 5 無意味なクエリでトライ! UNION ALLで一連の値を返すクエリを作成。 ↓こんな感じ select repeat(' union all select "b"',4000) into @a; set @a= concat('select "a" ', @a); prepare stmt1 from @a; execute stmt1; deallocate prepare stmt1;
  • 6. 6 できたクエリ • select "a" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union allselect "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b"
  • 7. 7 できたクエリ(一部拡大) • select "a" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union allselect "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" union all select "b" select “a” union all select “b” union all select “b” …
  • 8. 8 さて実行! mysql> select repeat(' union all select "b"',4000) into @a; Query OK, 1 row affected (0.00 sec) mysql> set @a= concat('select "a" ', @a); Query OK, 0 rows affected (0.00 sec) mysql> prepare stmt1 from @a; ERROR 1436 (HY000): Thread stack overrun: 246184 bytes used of a 262144 byte stack, and 16000 bytes needed. Use 'mysqld -- thread_stack=#' to specify a bigger stack.
  • 9. 9 スタック不足 • thread_stack – https://dev.mysql.com/doc/refman/5.6/ja/serve r-system-variables.html#sysvar_thread_stack • 各スレッドのスタックサイズ。デフォルトの 256KBは、通常の操作では十分な大きさです。 スレッドスタックサイズが小さすぎるとサーバ で処理できる SQL ステートメントの複雑さ、 ストアドプロシージャーの再帰の深さなど、メ モリーを大量に消費する処理が制限されます。
  • 10. 10 じゃ2倍の512KBで • 成功! • じゃreapeatも二倍の8000で! mysql> prepare stmt1 from @a; ERROR 1064 (42000): memory exhausted near '"b" union all select "b"' at line 1 →失敗orz
  • 11. 11 ERROR 1064 (42000) • 通常クエリが文法的に間違っているときによ くでる。 • perror 1064 – MySQL error code 1064 (ER_PARSE_ERROR): %s near ‘%-.80s’ at line %d • ただ今回は文法的にはあっている(はず)で キーワード(%s) が “memory exhausted “
  • 12. 12 ソースをfindstr (windowsのgrepライクなコマンド) • mysql-5.7.17¥sql>findstr /nsi /c:"memory exhausted" * • sql_hints.yy.cc:1362: yyoverflow (YY_("memory exhausted"), • sql_hints.yy.cc:2099: yyerror (thd, scanner, ret, YY_("memory exhausted")); • sql_yacc.cc:19899: yyoverflow (YY_("memory exhausted"), • sql_yacc.cc:41019: yyerror (&yylloc, YYTHD, YY_("memory exhausted"));
  • 13. 13 構文解析と字句解析 • クエリの解析 – 字句解析 – 構文解析 • 構文的には正しい(無意味な)複雑なクエリを 構文解析していて、内部的に用意しておいた メモリを使い果たしたらしい。。。 • 通常のプログラムでは構文解析にyacc, 字句 解析にlexを利用する。 – 拡張子.yyはyaccのソースファイル
  • 14. 14 bisonとflex • クエリの解析 – 字句解析: lex -> GNU版がflex – 構文解析: yacc -> GNU版がbison
  • 15. 15 MySQLの場合 • クエリの解析 – 字句解析: 自前で行っている – 構文解析: BNFで記述したソースをGNU bisonに てコンパイルして行っている。 • BNF(バッカス・ナウア記法) • バッカス・ナウア記法(英: Backus-Naur form)とは、文脈自由文法を定義するのに用 いられるメタ言語のことで、一般にBNFやBN 記法と略される。(wikipediaより引用)
  • 16. 16 SQL標準をBNFで • 初期のSQLは書籍などでBNF(バッカス・ナウ ア記法)の記述があった。 • 現在奇特な方がSQL-92, 99, 2003のBNFを 公開してなさる。(多分読みきれん) – https://github.com/ronsavage/SQL • これを使えば多分クエリの整形ツールをつ くったり(多分できる)、RDBMSを作ったりする ことができると思われます。(多分無理)
  • 17. 17 まとめ • MySQLのクエリの最大長(max_allowed_packet) • スタックに引っかかる場合→スタックサイズを 大きくして対応 • 構文解析でメモリを使い果たした場合→簡単 な対応なし(まぁほとんど起こらない) • MySQLのビルドになぜbisonが必要なのか、 と@kumagiのツイートの意味が分かった。
  • 18. 宣伝: 書籍情報 • おうちで学べるデータベースのきほん – DBの初心者はこちらをどうぞ。 – なぜか韓国語版が発売 • 入手方法 – じゃんけんで勝つ。 – もしくは、Amazonでポチる w。 18
  • 19. 19 THANK YOU • ご清聴ありがとうございました。 • [fyi] yacc/lexの参考書籍 – 日本語 • lex&yaccプログラミング (オライリージャパン) • Cコンパイラ設計―yacc/lexの応用 • yacc/lex―プログラムジェネレータon UNIX – 英語 • flex&bison (O‘reilly) – 比較的新しい(2009/08)本(@meijikは未見) – SQLの例がある(らしい)