On 10/15/17, korablev <[email protected]> wrote:
> Thanks, I really appreciate so fast responce. However, example above still
> doesn't work: planner prefers index 'a' instead of TABLE SCAN for WITHOUT
> ROWID table, when range of query covers full table.
My input is this:
CREATE TABLE t1(a PRIMARY KEY, b, c) WITHOUT ROWID;
WITH RECURSIVE
cnt(x) AS (VALUES(1000) UNION ALL SELECT x+1 FROM cnt WHERE x<2000)
INSERT INTO t1(a,b,c) SELECT x, x,x FROM cnt;
CREATE INDEX t1b ON t1(b);
ANALYZE;
EXPLAIN QUERY PLAN
SELECT * FROM t1 WHERE b BETWEEN 500 AND 2500;
EXPLAIN QUERY PLAN
SELECT * FROM t1 WHERE b BETWEEN 2900 AND 3000;
I get this output:
0|0|0|SCAN TABLE t1
0|0|0|SEARCH TABLE t1 USING INDEX t1b (b>? AND b<?)
Are you getting something different. Are you saying the above is wrong?
--
D. Richard Hipp
[email protected]
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users