104489b6dSdan# 2014 November 1 204489b6dSdan# 304489b6dSdan# The author disclaims copyright to this source code. In place of 404489b6dSdan# a legal notice, here is a blessing: 504489b6dSdan# 604489b6dSdan# May you do good and not evil. 704489b6dSdan# May you find forgiveness for yourself and forgive others. 804489b6dSdan# May you share freely, never taking more than you give. 904489b6dSdan# 1004489b6dSdan#*********************************************************************** 1104489b6dSdan# 1204489b6dSdan 1304489b6dSdanset testdir [file dirname $argv0] 1404489b6dSdansource $testdir/tester.tcl 1504489b6dSdanset testprefix scanstatus 1604489b6dSdan 17e2f771b0Sdanifcapable !scanstatus { 18e2f771b0Sdan finish_test 19e2f771b0Sdan return 20e2f771b0Sdan} 21e2f771b0Sdan 2204489b6dSdando_execsql_test 1.0 { 2304489b6dSdan CREATE TABLE t1(a, b); 2404489b6dSdan CREATE TABLE t2(x, y); 2504489b6dSdan INSERT INTO t1 VALUES(1, 2); 2604489b6dSdan INSERT INTO t1 VALUES(3, 4); 2704489b6dSdan INSERT INTO t2 VALUES('a', 'b'); 2804489b6dSdan INSERT INTO t2 VALUES('c', 'd'); 2904489b6dSdan INSERT INTO t2 VALUES('e', 'f'); 3004489b6dSdan} 3104489b6dSdan 3204489b6dSdanproc do_scanstatus_test {tn res} { 331df6470dSdrh set stmt [db version -last-stmt-ptr] 3404489b6dSdan set idx 0 3504489b6dSdan set ret [list] 3604489b6dSdan while {1} { 3704489b6dSdan set r [sqlite3_stmt_scanstatus $stmt $idx] 3804489b6dSdan if {[llength $r]==0} break 3904489b6dSdan lappend ret {*}$r 4004489b6dSdan incr idx 4104489b6dSdan } 4204489b6dSdan 4304489b6dSdan uplevel [list do_test $tn [list set {} $ret] [list {*}$res]] 4404489b6dSdan} 4504489b6dSdan 4604489b6dSdando_execsql_test 1.1 { SELECT count(*) FROM t1, t2; } 6 4704489b6dSdando_scanstatus_test 1.2 { 488210233cSdrh nLoop 1 nVisit 2 nEst 1048576.0 zName t1 zExplain {SCAN t1} 498210233cSdrh nLoop 2 nVisit 6 nEst 1048576.0 zName t2 zExplain {SCAN t2} 5004489b6dSdan} 5104489b6dSdan 5204489b6dSdando_execsql_test 1.3 { 5304489b6dSdan ANALYZE; 5404489b6dSdan SELECT count(*) FROM t1, t2; 5504489b6dSdan} 6 5604489b6dSdando_scanstatus_test 1.4 { 578210233cSdrh nLoop 1 nVisit 2 nEst 2.0 zName t1 zExplain {SCAN t1} 588210233cSdrh nLoop 2 nVisit 6 nEst 3.0 zName t2 zExplain {SCAN t2} 5904489b6dSdan} 6004489b6dSdan 6189e71646Sdando_execsql_test 1.5 { ANALYZE } 6289e71646Sdando_execsql_test 1.6 { 6304489b6dSdan SELECT count(*) FROM t1, t2 WHERE t2.rowid>1; 6404489b6dSdan} 4 6589e71646Sdando_scanstatus_test 1.7 { 66518140edSdrh nLoop 1 nVisit 2 nEst 2.0 zName t2 zExplain 678210233cSdrh {SEARCH t2 USING INTEGER PRIMARY KEY (rowid>?)} 688210233cSdrh nLoop 2 nVisit 4 nEst 2.0 zName t1 zExplain {SCAN t1} 6904489b6dSdan} 7004489b6dSdan 7189e71646Sdando_execsql_test 1.8 { 7289e71646Sdan SELECT count(*) FROM t1, t2 WHERE t2.rowid>1; 7389e71646Sdan} 4 7489e71646Sdan 7589e71646Sdando_scanstatus_test 1.9 { 76518140edSdrh nLoop 2 nVisit 4 nEst 2.0 zName t2 zExplain 778210233cSdrh {SEARCH t2 USING INTEGER PRIMARY KEY (rowid>?)} 788210233cSdrh nLoop 4 nVisit 8 nEst 2.0 zName t1 zExplain {SCAN t1} 7989e71646Sdan} 8089e71646Sdan 8189e71646Sdando_test 1.9 { 821df6470dSdrh sqlite3_stmt_scanstatus_reset [db version -last-stmt-ptr] 8389e71646Sdan} {} 8489e71646Sdan 8589e71646Sdando_scanstatus_test 1.10 { 86518140edSdrh nLoop 0 nVisit 0 nEst 2.0 zName t2 zExplain 878210233cSdrh {SEARCH t2 USING INTEGER PRIMARY KEY (rowid>?)} 888210233cSdrh nLoop 0 nVisit 0 nEst 2.0 zName t1 zExplain {SCAN t1} 8989e71646Sdan} 9089e71646Sdan 9189e71646Sdan#------------------------------------------------------------------------- 9289e71646Sdan# Try a few different types of scans. 9389e71646Sdan# 9489e71646Sdanreset_db 9589e71646Sdando_execsql_test 2.1 { 9689e71646Sdan CREATE TABLE x1(i INTEGER PRIMARY KEY, j); 9789e71646Sdan INSERT INTO x1 VALUES(1, 'one'); 9889e71646Sdan INSERT INTO x1 VALUES(2, 'two'); 9989e71646Sdan INSERT INTO x1 VALUES(3, 'three'); 10089e71646Sdan INSERT INTO x1 VALUES(4, 'four'); 10189e71646Sdan CREATE INDEX x1j ON x1(j); 10289e71646Sdan 10389e71646Sdan SELECT * FROM x1 WHERE i=2; 10489e71646Sdan} {2 two} 10589e71646Sdan 10689e71646Sdando_scanstatus_test 2.2 { 107518140edSdrh nLoop 1 nVisit 1 nEst 1.0 zName x1 1088210233cSdrh zExplain {SEARCH x1 USING INTEGER PRIMARY KEY (rowid=?)} 10989e71646Sdan} 11089e71646Sdan 11189e71646Sdando_execsql_test 2.3.1 { 11289e71646Sdan SELECT * FROM x1 WHERE j='two' 11389e71646Sdan} {2 two} 11489e71646Sdando_scanstatus_test 2.3.2 { 115518140edSdrh nLoop 1 nVisit 1 nEst 10.0 zName x1j 1168210233cSdrh zExplain {SEARCH x1 USING COVERING INDEX x1j (j=?)} 11789e71646Sdan} 11889e71646Sdan 11989e71646Sdando_execsql_test 2.4.1 { 12089e71646Sdan SELECT * FROM x1 WHERE j<'two' 12189e71646Sdan} {4 four 1 one 3 three} 12289e71646Sdando_scanstatus_test 2.4.2 { 123518140edSdrh nLoop 1 nVisit 3 nEst 262144.0 zName x1j 1248210233cSdrh zExplain {SEARCH x1 USING COVERING INDEX x1j (j<?)} 12589e71646Sdan} 12689e71646Sdan 12789e71646Sdando_execsql_test 2.5.1 { 12889e71646Sdan SELECT * FROM x1 WHERE j>='two' 12989e71646Sdan} {2 two} 13089e71646Sdando_scanstatus_test 2.5.2 { 131518140edSdrh nLoop 1 nVisit 1 nEst 262144.0 zName x1j 1328210233cSdrh zExplain {SEARCH x1 USING COVERING INDEX x1j (j>?)} 13389e71646Sdan} 13489e71646Sdan 13589e71646Sdando_execsql_test 2.6.1 { 13689e71646Sdan SELECT * FROM x1 WHERE j BETWEEN 'three' AND 'two' 13789e71646Sdan} {3 three 2 two} 13889e71646Sdando_scanstatus_test 2.6.2 { 139518140edSdrh nLoop 1 nVisit 2 nEst 16384.0 zName x1j 1408210233cSdrh zExplain {SEARCH x1 USING COVERING INDEX x1j (j>? AND j<?)} 14189e71646Sdan} 14289e71646Sdan 14389e71646Sdando_execsql_test 2.7.1 { 14489e71646Sdan CREATE TABLE x2(i INTEGER, j, k); 14589e71646Sdan INSERT INTO x2 SELECT i, j, i || ' ' || j FROM x1; 14689e71646Sdan CREATE INDEX x2j ON x2(j); 14789e71646Sdan CREATE INDEX x2ij ON x2(i, j); 14889e71646Sdan SELECT * FROM x2 WHERE j BETWEEN 'three' AND 'two' 14989e71646Sdan} {3 three {3 three} 2 two {2 two}} 15089e71646Sdan 15189e71646Sdando_scanstatus_test 2.7.2 { 152518140edSdrh nLoop 1 nVisit 2 nEst 16384.0 zName x2j 1538210233cSdrh zExplain {SEARCH x2 USING INDEX x2j (j>? AND j<?)} 15489e71646Sdan} 15589e71646Sdan 15689e71646Sdando_execsql_test 2.8.1 { 15789e71646Sdan SELECT * FROM x2 WHERE i=1 AND j='two' 15889e71646Sdan} 15989e71646Sdando_scanstatus_test 2.8.2 { 160518140edSdrh nLoop 1 nVisit 0 nEst 8.0 zName x2ij 1618210233cSdrh zExplain {SEARCH x2 USING INDEX x2ij (i=? AND j=?)} 16289e71646Sdan} 16389e71646Sdan 16489e71646Sdando_execsql_test 2.9.1 { 16589e71646Sdan SELECT * FROM x2 WHERE i=5 AND j='two' 16689e71646Sdan} 16789e71646Sdando_scanstatus_test 2.9.2 { 168518140edSdrh nLoop 1 nVisit 0 nEst 8.0 zName x2ij 1698210233cSdrh zExplain {SEARCH x2 USING INDEX x2ij (i=? AND j=?)} 17089e71646Sdan} 17189e71646Sdan 17289e71646Sdando_execsql_test 2.10.1 { 17389e71646Sdan SELECT * FROM x2 WHERE i=3 AND j='three' 17489e71646Sdan} {3 three {3 three}} 17589e71646Sdando_scanstatus_test 2.10.2 { 176518140edSdrh nLoop 1 nVisit 1 nEst 8.0 zName x2ij 1778210233cSdrh zExplain {SEARCH x2 USING INDEX x2ij (i=? AND j=?)} 17889e71646Sdan} 17989e71646Sdan 18089e71646Sdan#------------------------------------------------------------------------- 18189e71646Sdan# Try with queries that use the OR optimization. 18289e71646Sdan# 18389e71646Sdando_execsql_test 3.1 { 18489e71646Sdan CREATE TABLE a1(a, b, c, d); 18589e71646Sdan CREATE INDEX a1a ON a1(a); 18689e71646Sdan CREATE INDEX a1bc ON a1(b, c); 18789e71646Sdan 18889e71646Sdan WITH d(x) AS (SELECT 1 UNION ALL SELECT x+1 AS n FROM d WHERE n<=100) 18989e71646Sdan INSERT INTO a1 SELECT x, x, x, x FROM d; 19089e71646Sdan} 19189e71646Sdan 19289e71646Sdando_execsql_test 3.2.1 { 19389e71646Sdan SELECT d FROM a1 WHERE (a=4 OR b=13) 19489e71646Sdan} {4 13} 1956f9702edSdando_scanstatus_test 3.2.2 { 196518140edSdrh nLoop 1 nVisit 1 nEst 10.0 zName a1a 1978210233cSdrh zExplain {SEARCH a1 USING INDEX a1a (a=?)} 198518140edSdrh nLoop 1 nVisit 1 nEst 10.0 zName a1bc 1998210233cSdrh zExplain {SEARCH a1 USING INDEX a1bc (b=?)} 20089e71646Sdan} 20104489b6dSdan 2026f9702edSdando_execsql_test 3.2.1 { 2036f9702edSdan SELECT count(*) FROM a1 WHERE (a BETWEEN 4 AND 12) OR (b BETWEEN 40 AND 60) 2046f9702edSdan} {30} 2056f9702edSdando_scanstatus_test 3.2.2 { 206518140edSdrh nLoop 1 nVisit 9 nEst 16384.0 zName a1a 2078210233cSdrh zExplain {SEARCH a1 USING INDEX a1a (a>? AND a<?)} 208518140edSdrh nLoop 1 nVisit 21 nEst 16384.0 zName a1bc 2098210233cSdrh zExplain {SEARCH a1 USING INDEX a1bc (b>? AND b<?)} 2106f9702edSdan} 21104489b6dSdan 2126f9702edSdando_execsql_test 3.3.1 { 2136f9702edSdan SELECT count(*) FROM a1 AS x, a1 AS y 2146f9702edSdan WHERE (x.a BETWEEN 4 AND 12) AND (y.b BETWEEN 1 AND 10) 2156f9702edSdan} {90} 2166f9702edSdando_scanstatus_test 3.2.2 { 217518140edSdrh nLoop 1 nVisit 10 nEst 16384.0 zName a1bc 218*46bee2aaSdrh zExplain {SEARCH y USING COVERING INDEX a1bc (b>? AND b<?)} 219518140edSdrh nLoop 10 nVisit 90 nEst 16384.0 zName a1a 220*46bee2aaSdrh zExplain {SEARCH x USING COVERING INDEX a1a (a>? AND a<?)} 2216f9702edSdan} 2226f9702edSdan 2236f9702edSdando_execsql_test 3.4.1 { 2246f9702edSdan SELECT count(*) FROM a1 WHERE a IN (1, 5, 10, 15); 2256f9702edSdan} {4} 2266f9702edSdando_scanstatus_test 3.4.2 { 227518140edSdrh nLoop 1 nVisit 4 nEst 40.0 zName a1a 2288210233cSdrh zExplain {SEARCH a1 USING COVERING INDEX a1a (a=?)} 2296f9702edSdan} 2306f9702edSdan 2316f9702edSdando_execsql_test 3.4.1 { 2326f9702edSdan SELECT count(*) FROM a1 WHERE rowid IN (1, 5, 10, 15); 2336f9702edSdan} {4} 2346f9702edSdando_scanstatus_test 3.4.2 { 235518140edSdrh nLoop 1 nVisit 4 nEst 4.0 zName a1 2368210233cSdrh zExplain {SEARCH a1 USING INTEGER PRIMARY KEY (rowid=?)} 2376f9702edSdan} 23804489b6dSdan 239037b5324Sdan#------------------------------------------------------------------------- 240037b5324Sdan# Test that scanstatus() data is not available for searches performed 241037b5324Sdan# by triggers. 242037b5324Sdan# 243037b5324Sdan# It is available for searches performed as part of FK processing, but 244037b5324Sdan# not FK action processing. 245037b5324Sdan# 246037b5324Sdando_execsql_test 4.0 { 247037b5324Sdan CREATE TABLE t1(a, b, c); 248037b5324Sdan CREATE TABLE t2(x PRIMARY KEY, y, z); 249037b5324Sdan CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN 250037b5324Sdan SELECT * FROM t2 WHERE x BETWEEN 20 AND 40; 251037b5324Sdan END; 252037b5324Sdan WITH d(x) AS (SELECT 1 UNION ALL SELECT x+1 AS n FROM d WHERE n<=100) 253037b5324Sdan INSERT INTO t2 SELECT x, x*2, x*3 FROM d; 254037b5324Sdan} 255037b5324Sdan 256037b5324Sdando_execsql_test 4.1.1 { INSERT INTO t1 VALUES(1, 2, 3); } 257037b5324Sdando_scanstatus_test 4.1.2 {} 258037b5324Sdan 259037b5324Sdando_execsql_test 4.2 { 260037b5324Sdan CREATE TABLE p1(x PRIMARY KEY); 261037b5324Sdan INSERT INTO p1 VALUES(1), (2), (3), (4); 262037b5324Sdan CREATE TABLE c1(y REFERENCES p1); 263037b5324Sdan INSERT INTO c1 VALUES(1), (2), (3); 264037b5324Sdan PRAGMA foreign_keys=on; 265037b5324Sdan} 266037b5324Sdando_execsql_test 4.2.1 { DELETE FROM p1 WHERE x=4 } 267037b5324Sdando_scanstatus_test 4.2.2 { 268518140edSdrh nLoop 1 nVisit 1 nEst 1.0 zName sqlite_autoindex_p1_1 2698210233cSdrh zExplain {SEARCH p1 USING INDEX sqlite_autoindex_p1_1 (x=?)} 270037b5324Sdan 2718210233cSdrh nLoop 1 nVisit 3 nEst 262144.0 zName c1 zExplain {SCAN c1} 272037b5324Sdan} 273037b5324Sdan 274e2f771b0Sdan#------------------------------------------------------------------------- 275e2f771b0Sdan# Further tests of different scan types. 276e2f771b0Sdan# 277e2f771b0Sdanreset_db 278e2f771b0Sdanproc tochar {i} { 279e2f771b0Sdan set alphabet {a b c d e f g h i j k l m n o p q r s t u v w x y z} 280e2f771b0Sdan return [lindex $alphabet [expr $i % [llength $alphabet]]] 281e2f771b0Sdan} 282e2f771b0Sdandb func tochar tochar 283e2f771b0Sdando_execsql_test 5.0 { 284e2f771b0Sdan CREATE TABLE t1(a PRIMARY KEY, b, c); 285e2f771b0Sdan INSERT INTO t1 VALUES(0, 1, 'a'); 286e2f771b0Sdan INSERT INTO t1 VALUES(1, 0, 'b'); 287e2f771b0Sdan INSERT INTO t1 VALUES(2, 1, 'c'); 288e2f771b0Sdan INSERT INTO t1 VALUES(3, 0, 'd'); 289e2f771b0Sdan INSERT INTO t1 VALUES(4, 1, 'e'); 290e2f771b0Sdan INSERT INTO t1 VALUES(5, 0, 'a'); 291e2f771b0Sdan INSERT INTO t1 VALUES(6, 1, 'b'); 292e2f771b0Sdan INSERT INTO t1 VALUES(7, 0, 'c'); 293e2f771b0Sdan INSERT INTO t1 VALUES(8, 1, 'd'); 294e2f771b0Sdan INSERT INTO t1 VALUES(9, 0, 'e'); 295e2f771b0Sdan CREATE INDEX t1bc ON t1(b, c); 296e2f771b0Sdan 297e2f771b0Sdan CREATE TABLE t2(x, y); 298e2f771b0Sdan CREATE INDEX t2xy ON t2(x, y); 299e2f771b0Sdan WITH data(i, x, y) AS ( 300e2f771b0Sdan SELECT 0, 0, tochar(0) 301e2f771b0Sdan UNION ALL 302e2f771b0Sdan SELECT i+1, (i+1)%2, tochar(i+1) FROM data WHERE i<500 303e2f771b0Sdan ) INSERT INTO t2 SELECT x, y FROM data; 304e2f771b0Sdan 305e2f771b0Sdan CREATE TABLE t3(x, y); 306e2f771b0Sdan INSERT INTO t3 SELECT * FROM t2; 307e2f771b0Sdan 308e2f771b0Sdan ANALYZE; 309e2f771b0Sdan} 310e2f771b0Sdan 311e2f771b0Sdando_execsql_test 5.1.1 { 312e2f771b0Sdan SELECT count(*) FROM t1 WHERE a IN (SELECT b FROM t1 AS ii) 313e2f771b0Sdan} {2} 314e2f771b0Sdando_scanstatus_test 5.1.2 { 315518140edSdrh nLoop 1 nVisit 10 nEst 10.0 zName t1bc 316*46bee2aaSdrh zExplain {SCAN ii USING COVERING INDEX t1bc} 317518140edSdrh nLoop 1 nVisit 2 nEst 8.0 zName sqlite_autoindex_t1_1 3188210233cSdrh zExplain {SEARCH t1 USING COVERING INDEX sqlite_autoindex_t1_1 (a=?)} 319e2f771b0Sdan} 320e2f771b0Sdan 321e2f771b0Sdando_execsql_test 5.2.1 { 322e2f771b0Sdan SELECT count(*) FROM t1 WHERE a IN (0, 1) 323e2f771b0Sdan} {2} 324e2f771b0Sdando_scanstatus_test 5.2.2 { 325518140edSdrh nLoop 1 nVisit 2 nEst 2.0 zName sqlite_autoindex_t1_1 3268210233cSdrh zExplain {SEARCH t1 USING COVERING INDEX sqlite_autoindex_t1_1 (a=?)} 327e2f771b0Sdan} 328e2f771b0Sdan 329e2f771b0Sdando_eqp_test 5.3.1 { 330e2f771b0Sdan SELECT count(*) FROM t2 WHERE y = 'j'; 3318210233cSdrh} {SEARCH t2 USING COVERING INDEX t2xy (ANY(x) AND y=?)} 332e2f771b0Sdando_execsql_test 5.3.2 { 333e2f771b0Sdan SELECT count(*) FROM t2 WHERE y = 'j'; 334e2f771b0Sdan} {19} 335e2f771b0Sdando_scanstatus_test 5.3.3 { 33699bbcc82Sdrh nLoop 1 nVisit 19 nEst 56.0 zName t2xy zExplain 3378210233cSdrh {SEARCH t2 USING COVERING INDEX t2xy (ANY(x) AND y=?)} 338e2f771b0Sdan} 339e2f771b0Sdan 340e2f771b0Sdando_eqp_test 5.4.1 { 341e2f771b0Sdan SELECT count(*) FROM t1, t2 WHERE y = c; 342e2f771b0Sdan} { 343b3f0276bSdrh QUERY PLAN 3448210233cSdrh |--SCAN t1 USING COVERING INDEX t1bc 3458210233cSdrh `--SEARCH t2 USING COVERING INDEX t2xy (ANY(x) AND y=?) 346e2f771b0Sdan} 347e2f771b0Sdando_execsql_test 5.4.2 { 348e2f771b0Sdan SELECT count(*) FROM t1, t2 WHERE y = c; 349e2f771b0Sdan} {200} 350e2f771b0Sdando_scanstatus_test 5.4.3 { 351518140edSdrh nLoop 1 nVisit 10 nEst 10.0 zName t1bc 3528210233cSdrh zExplain {SCAN t1 USING COVERING INDEX t1bc} 35399bbcc82Sdrh nLoop 10 nVisit 200 nEst 56.0 zName t2xy 3548210233cSdrh zExplain {SEARCH t2 USING COVERING INDEX t2xy (ANY(x) AND y=?)} 355e2f771b0Sdan} 356e2f771b0Sdan 357e2f771b0Sdando_eqp_test 5.5.1 { 358e2f771b0Sdan SELECT count(*) FROM t1, t3 WHERE y = c; 359e2f771b0Sdan} { 360b3f0276bSdrh QUERY PLAN 3618210233cSdrh |--SCAN t3 3628210233cSdrh `--SEARCH t1 USING AUTOMATIC COVERING INDEX (c=?) 363e2f771b0Sdan} 364e2f771b0Sdando_execsql_test 5.5.2 { 365e2f771b0Sdan SELECT count(*) FROM t1, t3 WHERE y = c; 366e2f771b0Sdan} {200} 367e2f771b0Sdando_scanstatus_test 5.5.3 { 3688210233cSdrh nLoop 1 nVisit 501 nEst 480.0 zName t3 zExplain {SCAN t3} 369518140edSdrh nLoop 501 nVisit 200 nEst 20.0 zName auto-index zExplain 3708210233cSdrh {SEARCH t1 USING AUTOMATIC COVERING INDEX (c=?)} 371e2f771b0Sdan} 372e2f771b0Sdan 373e2f771b0Sdan#------------------------------------------------------------------------- 374e2f771b0Sdan# Virtual table scans 375e2f771b0Sdan# 376e2f771b0Sdanifcapable fts3 { 377e2f771b0Sdan do_execsql_test 6.0 { 378e2f771b0Sdan CREATE VIRTUAL TABLE ft1 USING fts4; 379e2f771b0Sdan INSERT INTO ft1 VALUES('a d c f g h e i f c'); 380e2f771b0Sdan INSERT INTO ft1 VALUES('g c h b g b f f f g'); 381e2f771b0Sdan INSERT INTO ft1 VALUES('h h c c h f a e d d'); 382e2f771b0Sdan INSERT INTO ft1 VALUES('e j i j i e b c f g'); 383e2f771b0Sdan INSERT INTO ft1 VALUES('g f b g j c h a d f'); 384e2f771b0Sdan INSERT INTO ft1 VALUES('j i a e g f a i a c'); 385e2f771b0Sdan INSERT INTO ft1 VALUES('f d g g j j c a h g'); 386e2f771b0Sdan INSERT INTO ft1 VALUES('b d h a d j j j b i'); 387e2f771b0Sdan INSERT INTO ft1 VALUES('j e a b j e c b c i'); 388e2f771b0Sdan INSERT INTO ft1 VALUES('a d e f b j j c g d'); 389e2f771b0Sdan } 390e2f771b0Sdan do_execsql_test 6.1.1 { 391e2f771b0Sdan SELECT count(*) FROM ft1 WHERE ft1 MATCH 'd' 392e2f771b0Sdan } {6} 393e2f771b0Sdan do_scanstatus_test 6.1.2 { 394518140edSdrh nLoop 1 nVisit 6 nEst 24.0 zName ft1 zExplain 3958210233cSdrh {SCAN ft1 VIRTUAL TABLE INDEX 3:} 396e2f771b0Sdan } 397e2f771b0Sdan} 398e2f771b0Sdan 399e2f771b0Sdan 40004489b6dSdanfinish_test 401