OLD | NEW |
1 # 2013-11-13 | 1 # 2013-11-13 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 ANALYZE sqlite_master; | 266 ANALYZE sqlite_master; |
267 EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE b=1; | 267 EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE b=1; |
268 } {/ANY.a. AND b=/} | 268 } {/ANY.a. AND b=/} |
269 do_execsql_test skipscan1-6.3 { | 269 do_execsql_test skipscan1-6.3 { |
270 -- Two distinct values for the skip-scan column again. Skip-scan is not used. | 270 -- Two distinct values for the skip-scan column again. Skip-scan is not used. |
271 UPDATE sqlite_stat1 SET stat='500000 125000 62500'; | 271 UPDATE sqlite_stat1 SET stat='500000 125000 62500'; |
272 ANALYZE sqlite_master; | 272 ANALYZE sqlite_master; |
273 EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE b=1; | 273 EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE b=1; |
274 } {~/ANY/} | 274 } {~/ANY/} |
275 | 275 |
| 276 # If the sqlite_stat1 entry includes the "noskipscan" token, then never use |
| 277 # skipscan with that index. |
| 278 # |
| 279 do_execsql_test skipscan1-7.1 { |
| 280 UPDATE sqlite_stat1 SET stat='500000 125000 1 sz=100'; |
| 281 ANALYZE sqlite_master; |
| 282 EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE b=1; |
| 283 } {/ANY/} |
| 284 do_execsql_test skipscan1-7.2 { |
| 285 UPDATE sqlite_stat1 SET stat='500000 125000 1 noskipscan sz=100'; |
| 286 ANALYZE sqlite_master; |
| 287 EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE b=1; |
| 288 } {~/ANY/} |
| 289 do_execsql_test skipscan1-7.3 { |
| 290 UPDATE sqlite_stat1 SET stat='500000 125000 1 sz=100 noskipscan'; |
| 291 ANALYZE sqlite_master; |
| 292 EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE b=1; |
| 293 } {~/ANY/} |
| 294 |
| 295 # Ticket 8fd39115d8f46ece70e7d4b3c481d1bd86194746 2015-07-23 |
| 296 # Incorrect code generated for a skipscan within an OR optimization |
| 297 # on a WITHOUT ROWID table. |
| 298 # |
| 299 do_execsql_test skipscan1-8.1 { |
| 300 DROP TABLE IF EXISTS t1; |
| 301 CREATE TABLE t1(x, y, PRIMARY KEY(x,y)) WITHOUT ROWID; |
| 302 INSERT INTO t1(x,y) VALUES(1,'AB'); |
| 303 INSERT INTO t1(x,y) VALUES(2,'CD'); |
| 304 ANALYZE; |
| 305 DROP TABLE IF EXISTS sqlite_stat4; |
| 306 DELETE FROM sqlite_stat1; |
| 307 INSERT INTO sqlite_stat1(tbl,idx,stat) VALUES('t1','t1','1000000 100 1'); |
| 308 ANALYZE sqlite_master; |
| 309 SELECT * FROM t1 |
| 310 WHERE (y = 'AB' AND x <= 4) |
| 311 OR (y = 'EF' AND x = 5); |
| 312 } {1 AB} |
| 313 do_execsql_test skipscan1-8.1eqp { |
| 314 EXPLAIN QUERY PLAN |
| 315 SELECT * FROM t1 |
| 316 WHERE (y = 'AB' AND x <= 4) |
| 317 OR (y = 'EF' AND x = 5); |
| 318 } {/ANY/} |
| 319 do_execsql_test skipscan1-8.2 { |
| 320 SELECT * FROM t1 |
| 321 WHERE y = 'AB' OR (y = 'CD' AND x = 2) |
| 322 ORDER BY +x; |
| 323 } {1 AB 2 CD} |
| 324 |
276 finish_test | 325 finish_test |
OLD | NEW |