xTom Byars wrote:
> Returns
>
> SEARCH TABLE Tbl USING PRIMARY KEY (ID>? AND ID<?)
>
> Should that be (ID>=? AND ID<=?)

explain query plan select * from t where x between 1 and 42;
0|0|0|SEARCH TABLE t USING PRIMARY KEY (x>? AND x<?)

explain select * from t where x between 1 and 42;
addr  opcode         p1    p2    p3    p4             p5  comment
----  -------------  ----  ----  ----  -------------  --  -------------
0     Init           0     10    0                    00  Start at 10
1     OpenRead       1     2     0     k(1,)          00  root=2 iDb=0; 
sqlite_autoindex_t_1
2     Integer        1     1     0                    00  r[1]=1
3     SeekGE         1     9     1     1              00  key=r[1]
4     Integer        42    1     0                    00  r[1]=42
5       IdxGT          1     9     1     1              00  key=r[1]
6       Column         1     0     2                    00  r[2]=t.x
7       ResultRow      2     1     0                    00  output=r[2]
8     Next           1     5     0                    00
9     Halt           0     0     0                    00
10    Transaction    0     0     3     0              01  usesStmtJournal=0
11    Goto           0     1     0                    00

The actual search starts with >= 1 and stops with > 42.

The EQP output does not bother to always use the exact operator for index
range searches because it does not matter for the runtime estimate.


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to