Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

EXPLAIN

.import --csv -v examples/big-data.csv pairs

EXPLAIN SELECT * from pairs WHERE name = 'aaaaaaaz';

CREATE INDEX names ON pairs (name);

SELECT '--------------------------------';
EXPLAIN SELECT * from pairs WHERE name = 'aaaaaaaz';

$ sqlite < examples/big-data-explain.sql
Column separator ",", row separator "\n"
CREATE TABLE "main"."pairs"(
"name" ANY, "value" ANY)

Added 100000 rows with 0 errors using 100001 lines of input
addr  opcode         p1    p2    p3    p4             p5  comment      
----  -------------  ----  ----  ----  -------------  --  -------------
0     Init           0     10    0                    0   Start at 10
1     OpenRead       0     2     0     2              0   root=2 iDb=0; pairs
2     Rewind         0     9     0                    0   
3       Column         0     0     1                    0   r[1]= cursor 0 column 0
4       Ne             2     8     1     BINARY-8       83  if r[1]!=r[2] goto 8
5       Column         0     0     3                    0   r[3]= cursor 0 column 0
6       Column         0     1     4                    0   r[4]= cursor 0 column 1
7       ResultRow      3     2     0                    0   output=r[3..4]
8     Next           0     3     0                    1   
9     Halt           0     0     0                    0   
10    Transaction    0     0     1     0              1   usesStmtJournal=0
11    String8        0     2     0     aaaaaaaz       0   r[2]='aaaaaaaz'
12    Goto           0     1     0                    0   
--------------------------------
addr  opcode         p1    p2    p3    p4             p5  comment      
----  -------------  ----  ----  ----  -------------  --  -------------
0     Init           0     13    0                    0   Start at 13
1     OpenRead       0     2     0     2              0   root=2 iDb=0; pairs
2     OpenRead       1     483   0     k(2,,)         2   root=483 iDb=0; names
3     String8        0     1     0     aaaaaaaz       0   r[1]='aaaaaaaz'
4     Affinity       1     1     0     C              0   affinity(r[1])
5     SeekGE         1     12    1     1              0   key=r[1]
6       IdxGT          1     12    1     1              0   key=r[1]
7       DeferredSeek   1     0     0                    0   Move 0 to 1.rowid if needed
8       Column         1     0     2                    0   r[2]= cursor 1 column 0
9       Column         0     1     3                    0   r[3]= cursor 0 column 1
10      ResultRow      2     2     0                    0   output=r[2..3]
11    Next           1     6     1                    0   
12    Halt           0     0     0                    0   
13    Transaction    0     0     2     0              1   usesStmtJournal=0
14    Goto           0     1     0                    0