SQLite 資料一覧

SQLの仮想マシン命令を出力する

2008/4/10更新

対応バージョン: 3.5.7

SQL文の前にexplainキーワードを付けると実際のSQLを実行せず内部で実行される仮想マシン命令を出力するのでプログラムのデバッグなどに役立つ。

sqlite> select * from customer;
1|foo|01-234-5789|park
2|bar|99-999-9999|apart
3|baz||

sqlite> .explain ← クエリの出力形式をexplain(説明用)に設定

sqlite> explain select * from customer;
addr opcode        p1 p2 p3 p4                              p5 comment
---- ------------- -- -- -- ------------------------------- -- -------
0    Trace         0  0  0  explain select * from customer; 00
1    Goto          0  13 0                                  00
2    OpenRead      0  2  0                                  00
3    SetNumColumns 0  4  0                                  00
4    Rewind        0  11 0                                  00
5    Column        0  0  1                                  00
6    Column        0  1  2                                  00
7    Column        0  2  3                                  00
8    Column        0  3  4                                  00
9    ResultRow     1  4  0                                  00
10   Next          0  5  0                                  00
11   Close         0  0  0                                  00
12   Halt          0  0  0                                  00
13   Transaction   0  0  0                                  00
14   VerifyCookie  0  10 0                                  00
15   TableLock     0  2  0  customer                        00
16   Goto          0  2  0                                  00