Added SQLITE_SCANSTAT_SELECTID. Change the value returned by
SQLITE_SCANSTAT_EST from sqlite3_int64 to double. Enhanced the formatting and display of scan statistics using the ".scanstats on" command in the shell. FossilOrigin-Name: 20c7614addb8494cd7f40263a50fa6f428cce1c7
This commit is contained in:
commit
b1a6eada1d
30
manifest
30
manifest
@ -1,5 +1,5 @@
|
||||
C Fixes\sto\sthe\sWindows\sVFS\sto\sallow\smemory\smapped\sfiles\sto\swork\swithout\sWAL\ssupport.
|
||||
D 2014-11-05T21:34:56.096
|
||||
C Added\sSQLITE_SCANSTAT_SELECTID.\s\sChange\sthe\svalue\sreturned\sby\nSQLITE_SCANSTAT_EST\sfrom\ssqlite3_int64\sto\sdouble.\s\sEnhanced\sthe\sformatting\nand\sdisplay\sof\sscan\sstatistics\susing\sthe\s".scanstats\son"\scommand\sin\sthe\nshell.
|
||||
D 2014-11-06T14:43:53.299
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -228,8 +228,8 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
|
||||
F src/resolve.c 4965007d6497b6a4d7a6d98751cc39712885f952
|
||||
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
|
||||
F src/select.c 428165951748151e87a15295b7357221433e311b
|
||||
F src/shell.c 5ad1eb4dfcd7a57e15825207a9bd559415bf34b1
|
||||
F src/sqlite.h.in 6e9af739d79f0bea2584b70fb1c54d3bb1a2eab6
|
||||
F src/shell.c 48fe276aada42a15722aee2584e6321345ed4609
|
||||
F src/sqlite.h.in 087d30a4c7ec7ae19bcaa03a9db9d6ee7a73b0b3
|
||||
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
|
||||
F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d
|
||||
F src/sqliteInt.h 8f67ca79e957b8ece7453b8e320b6a996e1b4761
|
||||
@ -237,7 +237,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
|
||||
F src/status.c 81712116e826b0089bb221b018929536b2b5406f
|
||||
F src/table.c f142bba7903e93ca8d113a5b8877a108ad1a27dc
|
||||
F src/tclsqlite.c 7cdd4dd3c2a4183483feca260070d73d6e22cd47
|
||||
F src/test1.c 5890094c09691fe9564cf0f0d5b22d35b3218c47
|
||||
F src/test1.c ac7f3bad83ef4508d5efc85b32e86da48db8ed7e
|
||||
F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712
|
||||
F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c
|
||||
F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df
|
||||
@ -290,10 +290,10 @@ F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c
|
||||
F src/util.c 3b627daa45c7308c1e36e3dbaa3f9ce7e5c7fa73
|
||||
F src/vacuum.c 59f03f92bcff57faa6a8ca256eb29ccddfb0614a
|
||||
F src/vdbe.c 3fd4ebd3e87b63175bfd2be747608bae1670b4df
|
||||
F src/vdbe.h d412bd01e89f0d69991b8f46601f96bc169d28f4
|
||||
F src/vdbeInt.h 539ba284790e871f98be74a78cbdfcedfae22639
|
||||
F src/vdbeapi.c 900259bdd85cd66a9f210d8ec08147a9034593bd
|
||||
F src/vdbeaux.c cf6b8152dd22155201d57c216e6266866b61da59
|
||||
F src/vdbe.h 6fc69d9c5e146302c56e163cb4b31d1ee64a18c3
|
||||
F src/vdbeInt.h 9bb69ff2447c34b6ccc58b34ec35b615f86ead78
|
||||
F src/vdbeapi.c 07acb615d1e4170e71fc1b0d087f3c53a1ad8e83
|
||||
F src/vdbeaux.c 9b0a251b6dfab349dd6c6efb40062eb7386b26f5
|
||||
F src/vdbeblob.c 8b5442ff0954c44b45cbabbe2e94091a2e16fdef
|
||||
F src/vdbemem.c 31d8eabb0cd78bfeab4e5124c7363c3e9e54db9f
|
||||
F src/vdbesort.c 87f3923483113d1c95d84640becb4e4946f27d9a
|
||||
@ -302,7 +302,7 @@ F src/vtab.c 2a30791bbd7926b589401bd09c3abb33de563793
|
||||
F src/wal.c 825c948066c7604a07d56e67958cdab210749016
|
||||
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
||||
F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804
|
||||
F src/where.c 2c2081c546c90227577c502765611555503ce3f7
|
||||
F src/where.c 3862a1173ae2716bde12f1ab3fb649f1d85b05c2
|
||||
F src/whereInt.h d3633e9b592103241b74b0ec76185f3e5b8b62e0
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||
@ -801,7 +801,7 @@ F test/savepoint4.test c8f8159ade6d2acd9128be61e1230f1c1edc6cc0
|
||||
F test/savepoint5.test 0735db177e0ebbaedc39812c8d065075d563c4fd
|
||||
F test/savepoint6.test f41279c5e137139fa5c21485773332c7adb98cd7
|
||||
F test/savepoint7.test fbf319a7b2dda089ec5be30a424a0e95f121d423
|
||||
F test/scanstatus.test 01afb2220f18ce85f9e338c20684f428d56e5c01
|
||||
F test/scanstatus.test a6dd739bc4d9638e8f5c2493b518057f2b681655
|
||||
F test/schema.test 8f7999be894260f151adf15c2c7540f1c6d6a481
|
||||
F test/schema2.test 906408621ea881fdb496d878b1822572a34e32c5
|
||||
F test/schema3.test 1bc1008e1f8cb5654b248c55f27249366eb7ed38
|
||||
@ -1211,8 +1211,8 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 83a1e5db926b3a6d40f4a5cf9a8e6852b9bac9ac 6fc4ead26d19b9348bbda34c3053ae1e066abc32
|
||||
R 3ad47b2ac5693ba63ff5c591cf540d89
|
||||
T +closed 6fc4ead26d19b9348bbda34c3053ae1e066abc32
|
||||
P 272fddc14cc322655eeba670bc0f9fc30e5a804c ee922682bb7235dbcd23a22fcfdfa188f6d3228a
|
||||
R 1f66f00948a1acda590c099646f9e3d3
|
||||
T +closed ee922682bb7235dbcd23a22fcfdfa188f6d3228a
|
||||
U drh
|
||||
Z ee3b32335a4c8630acaf81919b28b64e
|
||||
Z 1da4b43998d0836d48029478818e14c6
|
||||
|
@ -1 +1 @@
|
||||
272fddc14cc322655eeba670bc0f9fc30e5a804c
|
||||
20c7614addb8494cd7f40263a50fa6f428cce1c7
|
56
src/shell.c
56
src/shell.c
@ -1194,32 +1194,40 @@ static void display_scanstats(
|
||||
ShellState *pArg /* Pointer to ShellState */
|
||||
){
|
||||
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
|
||||
int i;
|
||||
int i, k, n, mx;
|
||||
fprintf(pArg->out, "-------- scanstats --------\n");
|
||||
for(i=0; 1; i++){
|
||||
sqlite3_stmt *p = pArg->pStmt;
|
||||
sqlite3_int64 nEst, nLoop, nVisit;
|
||||
const char *zExplain;
|
||||
if( sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_NLOOP, (void*)&nLoop) ){
|
||||
break;
|
||||
mx = 0;
|
||||
for(k=0; k<=mx; k++){
|
||||
double rEstLoop = 1.0;
|
||||
for(i=n=0; 1; i++){
|
||||
sqlite3_stmt *p = pArg->pStmt;
|
||||
sqlite3_int64 nLoop, nVisit;
|
||||
double rEst;
|
||||
int iSid;
|
||||
const char *zExplain;
|
||||
if( sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_NLOOP, (void*)&nLoop) ){
|
||||
break;
|
||||
}
|
||||
sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_SELECTID, (void*)&iSid);
|
||||
if( iSid>mx ) mx = iSid;
|
||||
if( iSid!=k ) continue;
|
||||
if( n==0 ){
|
||||
rEstLoop = (double)nLoop;
|
||||
if( k>0 ) fprintf(pArg->out, "-------- subquery %d -------\n", k);
|
||||
}
|
||||
n++;
|
||||
sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_NVISIT, (void*)&nVisit);
|
||||
sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_EST, (void*)&rEst);
|
||||
sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_EXPLAIN, (void*)&zExplain);
|
||||
fprintf(pArg->out, "Loop %2d: %s\n", n, zExplain);
|
||||
rEstLoop *= rEst;
|
||||
fprintf(pArg->out, " nLoop=%-8lld nRow=%-8lld estRow=%-8lld estRow/Loop=%-8g\n",
|
||||
nLoop, nVisit, (sqlite3_int64)rEstLoop, rEst
|
||||
);
|
||||
}
|
||||
sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_NVISIT, (void*)&nVisit);
|
||||
sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_EST, (void*)&nEst);
|
||||
sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_EXPLAIN, (void*)&zExplain);
|
||||
|
||||
fprintf(pArg->out, "Loop %d: \"%s\"\n", i, zExplain);
|
||||
fprintf(pArg->out, " nLoop=%-8lld nVisit=%-8lld nEst=%-8lld\n",
|
||||
nLoop, nVisit, nEst
|
||||
);
|
||||
}
|
||||
#else
|
||||
fprintf(pArg->out, "-------- scanstats --------\n");
|
||||
fprintf(pArg->out,
|
||||
"sqlite3_stmt_scanstatus() unavailable - "
|
||||
"rebuild with SQLITE_ENABLE_STMT_SCANSTATUS\n"
|
||||
);
|
||||
#endif
|
||||
fprintf(pArg->out, "---------------------------\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1675,6 +1683,7 @@ static char zHelp[] =
|
||||
".read FILENAME Execute SQL in FILENAME\n"
|
||||
".restore ?DB? FILE Restore content of DB (default \"main\") from FILE\n"
|
||||
".save FILE Write in-memory database into FILE\n"
|
||||
".scanstats on|off Turn sqlite3_stmt_scanstatus() metrics on or off\n"
|
||||
".schema ?TABLE? Show the CREATE statements\n"
|
||||
" If TABLE specified, only show tables matching\n"
|
||||
" LIKE pattern TABLE.\n"
|
||||
@ -3060,6 +3069,9 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
if( c=='s' && strncmp(azArg[0], "scanstats", n)==0 ){
|
||||
if( nArg==2 ){
|
||||
p->scanstatsOn = booleanValue(azArg[1]);
|
||||
#ifndef SQLITE_ENABLE_STMT_SCANSTATUS
|
||||
fprintf(stderr, "Warning: .scanstats not available in this build.\n");
|
||||
#endif
|
||||
}else{
|
||||
fprintf(stderr, "Usage: .scanstats on|off\n");
|
||||
rc = 1;
|
||||
|
@ -7440,13 +7440,15 @@ int sqlite3_vtab_on_conflict(sqlite3 *);
|
||||
**
|
||||
** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
|
||||
** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be set to the
|
||||
** total number of rows visited by the X-th loop.</dd>
|
||||
** total number of rows examined by all iterations of the X-th loop.</dd>
|
||||
**
|
||||
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
|
||||
** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be set to the
|
||||
** query planner's estimate for the number of rows visited for each
|
||||
** iteration of the X-th loop. If the query planner's estimate was accurate,
|
||||
** then this value should be approximately NVISIT/NLOOP.
|
||||
** <dd>^The "double" variable pointed to by the T parameter will be set to the
|
||||
** query planner's estimate for the average number of rows output from each
|
||||
** iteration of the X-th loop. If the query planner's estimates was accurate,
|
||||
** then this value will approximate the quotient NVISIT/NLOOP and the
|
||||
** product of this value for all prior loops with the same SELECTID will
|
||||
** be the NLOOP value for the current loop.
|
||||
**
|
||||
** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
|
||||
** <dd>^The "const char *" variable pointed to by the T parameter will be set to
|
||||
@ -7457,6 +7459,13 @@ int sqlite3_vtab_on_conflict(sqlite3 *);
|
||||
** <dd>^The "const char *" variable pointed to by the T parameter will be set to
|
||||
** a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN] description
|
||||
** for the X-th loop.
|
||||
**
|
||||
** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECT</dt>
|
||||
** <dd>^The "int" variable pointed to by the T parameter will be set to the
|
||||
** "select-id" for the X-th loop. The select-id identifies which query or
|
||||
** subquery the loop is part of. The main query has a select-id of zero.
|
||||
** The select-id is the same value as is output in the first column
|
||||
** of an [EXPLAIN QUERY PLAN] query.
|
||||
** </dl>
|
||||
*/
|
||||
#define SQLITE_SCANSTAT_NLOOP 0
|
||||
@ -7464,6 +7473,7 @@ int sqlite3_vtab_on_conflict(sqlite3 *);
|
||||
#define SQLITE_SCANSTAT_EST 2
|
||||
#define SQLITE_SCANSTAT_NAME 3
|
||||
#define SQLITE_SCANSTAT_EXPLAIN 4
|
||||
#define SQLITE_SCANSTAT_SELECTID 5
|
||||
|
||||
/*
|
||||
** CAPI3REF: Prepared Statement Scan Status
|
||||
|
@ -2318,7 +2318,7 @@ static int test_stmt_scanstatus(
|
||||
const char *zExplain;
|
||||
sqlite3_int64 nLoop;
|
||||
sqlite3_int64 nVisit;
|
||||
sqlite3_int64 nEst;
|
||||
double rEst;
|
||||
int res;
|
||||
|
||||
if( objc!=3 ){
|
||||
@ -2336,9 +2336,9 @@ static int test_stmt_scanstatus(
|
||||
sqlite3_stmt_scanstatus(pStmt, idx, SQLITE_SCANSTAT_NVISIT, (void*)&nVisit);
|
||||
Tcl_ListObjAppendElement(0, pRet, Tcl_NewStringObj("nVisit", -1));
|
||||
Tcl_ListObjAppendElement(0, pRet, Tcl_NewWideIntObj(nVisit));
|
||||
sqlite3_stmt_scanstatus(pStmt, idx, SQLITE_SCANSTAT_EST, (void*)&nEst);
|
||||
sqlite3_stmt_scanstatus(pStmt, idx, SQLITE_SCANSTAT_EST, (void*)&rEst);
|
||||
Tcl_ListObjAppendElement(0, pRet, Tcl_NewStringObj("nEst", -1));
|
||||
Tcl_ListObjAppendElement(0, pRet, Tcl_NewWideIntObj(nEst));
|
||||
Tcl_ListObjAppendElement(0, pRet, Tcl_NewDoubleObj(rEst));
|
||||
sqlite3_stmt_scanstatus(pStmt, idx, SQLITE_SCANSTAT_NAME, (void*)&zName);
|
||||
Tcl_ListObjAppendElement(0, pRet, Tcl_NewStringObj("zName", -1));
|
||||
Tcl_ListObjAppendElement(0, pRet, Tcl_NewStringObj(zName, -1));
|
||||
|
@ -283,7 +283,7 @@ void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *);
|
||||
#endif
|
||||
|
||||
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
|
||||
void sqlite3VdbeScanStatus(Vdbe*, int, int, int, i64, const char*);
|
||||
void sqlite3VdbeScanStatus(Vdbe*, int, int, int, LogEst, const char*);
|
||||
#else
|
||||
# define sqlite3VdbeScanStatus(a,b,c,d,e)
|
||||
#endif
|
||||
|
@ -302,7 +302,8 @@ struct ScanStatus {
|
||||
int addrExplain; /* OP_Explain for loop */
|
||||
int addrLoop; /* Address of "loops" counter */
|
||||
int addrVisit; /* Address of "rows visited" counter */
|
||||
i64 nEst; /* Estimated rows per loop */
|
||||
int iSelectID; /* The "Select-ID" for this loop */
|
||||
LogEst nEst; /* Estimated output rows per loop */
|
||||
char *zName; /* Name of table or index */
|
||||
};
|
||||
|
||||
|
@ -1500,7 +1500,13 @@ int sqlite3_stmt_scanstatus(
|
||||
break;
|
||||
}
|
||||
case SQLITE_SCANSTAT_EST: {
|
||||
*(sqlite3_int64*)pOut = pScan->nEst;
|
||||
double r = 1.0;
|
||||
LogEst x = pScan->nEst;
|
||||
while( x<100 ){
|
||||
x += 10;
|
||||
r *= 0.5;
|
||||
}
|
||||
*(double*)pOut = r*sqlite3LogEstToInt(x);
|
||||
break;
|
||||
}
|
||||
case SQLITE_SCANSTAT_NAME: {
|
||||
@ -1515,6 +1521,14 @@ int sqlite3_stmt_scanstatus(
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SQLITE_SCANSTAT_SELECTID: {
|
||||
if( pScan->addrExplain ){
|
||||
*(int*)pOut = p->aOp[ pScan->addrExplain ].p1;
|
||||
}else{
|
||||
*(int*)pOut = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
return 1;
|
||||
}
|
||||
|
@ -606,7 +606,7 @@ void sqlite3VdbeScanStatus(
|
||||
int addrExplain, /* Address of OP_Explain (or 0) */
|
||||
int addrLoop, /* Address of loop counter */
|
||||
int addrVisit, /* Address of rows visited counter */
|
||||
i64 nEst, /* Estimated number of rows */
|
||||
LogEst nEst, /* Estimated number of output rows */
|
||||
const char *zName /* Name of table or index being scanned */
|
||||
){
|
||||
int nByte = (p->nScan+1) * sizeof(ScanStatus);
|
||||
|
@ -2946,18 +2946,14 @@ static void addScanStatus(
|
||||
int addrExplain /* Address of OP_Explain (or 0) */
|
||||
){
|
||||
const char *zObj = 0;
|
||||
i64 nEst = 1;
|
||||
WhereLoop *pLoop = pLvl->pWLoop;
|
||||
if( (pLoop->wsFlags & (WHERE_IPK|WHERE_VIRTUALTABLE))==0 ){
|
||||
zObj = pLoop->u.btree.pIndex->zName;
|
||||
}else{
|
||||
zObj = pSrclist->a[pLvl->iFrom].zName;
|
||||
}
|
||||
if( pLoop->nOut>=10 ){
|
||||
nEst = sqlite3LogEstToInt(pLoop->nOut);
|
||||
}
|
||||
sqlite3VdbeScanStatus(
|
||||
v, addrExplain, pLvl->addrBody, pLvl->addrVisit, nEst, zObj
|
||||
v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj
|
||||
);
|
||||
}
|
||||
#else
|
||||
|
@ -45,8 +45,8 @@ proc do_scanstatus_test {tn res} {
|
||||
|
||||
do_execsql_test 1.1 { SELECT count(*) FROM t1, t2; } 6
|
||||
do_scanstatus_test 1.2 {
|
||||
nLoop 1 nVisit 2 nEst 1048576 zName t1 zExplain {SCAN TABLE t1}
|
||||
nLoop 2 nVisit 6 nEst 1048576 zName t2 zExplain {SCAN TABLE t2}
|
||||
nLoop 1 nVisit 2 nEst 1048576.0 zName t1 zExplain {SCAN TABLE t1}
|
||||
nLoop 2 nVisit 6 nEst 1048576.0 zName t2 zExplain {SCAN TABLE t2}
|
||||
}
|
||||
|
||||
do_execsql_test 1.3 {
|
||||
@ -54,8 +54,8 @@ do_execsql_test 1.3 {
|
||||
SELECT count(*) FROM t1, t2;
|
||||
} 6
|
||||
do_scanstatus_test 1.4 {
|
||||
nLoop 1 nVisit 2 nEst 2 zName t1 zExplain {SCAN TABLE t1}
|
||||
nLoop 2 nVisit 6 nEst 3 zName t2 zExplain {SCAN TABLE t2}
|
||||
nLoop 1 nVisit 2 nEst 2.0 zName t1 zExplain {SCAN TABLE t1}
|
||||
nLoop 2 nVisit 6 nEst 3.0 zName t2 zExplain {SCAN TABLE t2}
|
||||
}
|
||||
|
||||
do_execsql_test 1.5 { ANALYZE }
|
||||
@ -63,9 +63,9 @@ do_execsql_test 1.6 {
|
||||
SELECT count(*) FROM t1, t2 WHERE t2.rowid>1;
|
||||
} 4
|
||||
do_scanstatus_test 1.7 {
|
||||
nLoop 1 nVisit 2 nEst 2 zName t2 zExplain
|
||||
nLoop 1 nVisit 2 nEst 2.0 zName t2 zExplain
|
||||
{SEARCH TABLE t2 USING INTEGER PRIMARY KEY (rowid>?)}
|
||||
nLoop 2 nVisit 4 nEst 2 zName t1 zExplain {SCAN TABLE t1}
|
||||
nLoop 2 nVisit 4 nEst 2.0 zName t1 zExplain {SCAN TABLE t1}
|
||||
}
|
||||
|
||||
do_execsql_test 1.8 {
|
||||
@ -73,9 +73,9 @@ do_execsql_test 1.8 {
|
||||
} 4
|
||||
|
||||
do_scanstatus_test 1.9 {
|
||||
nLoop 2 nVisit 4 nEst 2 zName t2 zExplain
|
||||
nLoop 2 nVisit 4 nEst 2.0 zName t2 zExplain
|
||||
{SEARCH TABLE t2 USING INTEGER PRIMARY KEY (rowid>?)}
|
||||
nLoop 4 nVisit 8 nEst 2 zName t1 zExplain {SCAN TABLE t1}
|
||||
nLoop 4 nVisit 8 nEst 2.0 zName t1 zExplain {SCAN TABLE t1}
|
||||
}
|
||||
|
||||
do_test 1.9 {
|
||||
@ -83,9 +83,9 @@ do_test 1.9 {
|
||||
} {}
|
||||
|
||||
do_scanstatus_test 1.10 {
|
||||
nLoop 0 nVisit 0 nEst 2 zName t2 zExplain
|
||||
nLoop 0 nVisit 0 nEst 2.0 zName t2 zExplain
|
||||
{SEARCH TABLE t2 USING INTEGER PRIMARY KEY (rowid>?)}
|
||||
nLoop 0 nVisit 0 nEst 2 zName t1 zExplain {SCAN TABLE t1}
|
||||
nLoop 0 nVisit 0 nEst 2.0 zName t1 zExplain {SCAN TABLE t1}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -104,7 +104,7 @@ do_execsql_test 2.1 {
|
||||
} {2 two}
|
||||
|
||||
do_scanstatus_test 2.2 {
|
||||
nLoop 1 nVisit 1 nEst 1 zName x1
|
||||
nLoop 1 nVisit 1 nEst 1.0 zName x1
|
||||
zExplain {SEARCH TABLE x1 USING INTEGER PRIMARY KEY (rowid=?)}
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ do_execsql_test 2.3.1 {
|
||||
SELECT * FROM x1 WHERE j='two'
|
||||
} {2 two}
|
||||
do_scanstatus_test 2.3.2 {
|
||||
nLoop 1 nVisit 1 nEst 10 zName x1j
|
||||
nLoop 1 nVisit 1 nEst 10.0 zName x1j
|
||||
zExplain {SEARCH TABLE x1 USING COVERING INDEX x1j (j=?)}
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ do_execsql_test 2.4.1 {
|
||||
SELECT * FROM x1 WHERE j<'two'
|
||||
} {4 four 1 one 3 three}
|
||||
do_scanstatus_test 2.4.2 {
|
||||
nLoop 1 nVisit 3 nEst 262144 zName x1j
|
||||
nLoop 1 nVisit 3 nEst 262144.0 zName x1j
|
||||
zExplain {SEARCH TABLE x1 USING COVERING INDEX x1j (j<?)}
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ do_execsql_test 2.5.1 {
|
||||
SELECT * FROM x1 WHERE j>='two'
|
||||
} {2 two}
|
||||
do_scanstatus_test 2.5.2 {
|
||||
nLoop 1 nVisit 1 nEst 262144 zName x1j
|
||||
nLoop 1 nVisit 1 nEst 262144.0 zName x1j
|
||||
zExplain {SEARCH TABLE x1 USING COVERING INDEX x1j (j>?)}
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ do_execsql_test 2.6.1 {
|
||||
SELECT * FROM x1 WHERE j BETWEEN 'three' AND 'two'
|
||||
} {3 three 2 two}
|
||||
do_scanstatus_test 2.6.2 {
|
||||
nLoop 1 nVisit 2 nEst 16384 zName x1j
|
||||
nLoop 1 nVisit 2 nEst 16384.0 zName x1j
|
||||
zExplain {SEARCH TABLE x1 USING COVERING INDEX x1j (j>? AND j<?)}
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ do_execsql_test 2.7.1 {
|
||||
} {3 three {3 three} 2 two {2 two}}
|
||||
|
||||
do_scanstatus_test 2.7.2 {
|
||||
nLoop 1 nVisit 2 nEst 16384 zName x2j
|
||||
nLoop 1 nVisit 2 nEst 16384.0 zName x2j
|
||||
zExplain {SEARCH TABLE x2 USING INDEX x2j (j>? AND j<?)}
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ do_execsql_test 2.8.1 {
|
||||
SELECT * FROM x2 WHERE i=1 AND j='two'
|
||||
}
|
||||
do_scanstatus_test 2.8.2 {
|
||||
nLoop 1 nVisit 0 nEst 8 zName x2ij
|
||||
nLoop 1 nVisit 0 nEst 8.0 zName x2ij
|
||||
zExplain {SEARCH TABLE x2 USING INDEX x2ij (i=? AND j=?)}
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ do_execsql_test 2.9.1 {
|
||||
SELECT * FROM x2 WHERE i=5 AND j='two'
|
||||
}
|
||||
do_scanstatus_test 2.9.2 {
|
||||
nLoop 1 nVisit 0 nEst 8 zName x2ij
|
||||
nLoop 1 nVisit 0 nEst 8.0 zName x2ij
|
||||
zExplain {SEARCH TABLE x2 USING INDEX x2ij (i=? AND j=?)}
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ do_execsql_test 2.10.1 {
|
||||
SELECT * FROM x2 WHERE i=3 AND j='three'
|
||||
} {3 three {3 three}}
|
||||
do_scanstatus_test 2.10.2 {
|
||||
nLoop 1 nVisit 1 nEst 8 zName x2ij
|
||||
nLoop 1 nVisit 1 nEst 8.0 zName x2ij
|
||||
zExplain {SEARCH TABLE x2 USING INDEX x2ij (i=? AND j=?)}
|
||||
}
|
||||
|
||||
@ -193,9 +193,9 @@ do_execsql_test 3.2.1 {
|
||||
SELECT d FROM a1 WHERE (a=4 OR b=13)
|
||||
} {4 13}
|
||||
do_scanstatus_test 3.2.2 {
|
||||
nLoop 1 nVisit 1 nEst 10 zName a1a
|
||||
nLoop 1 nVisit 1 nEst 10.0 zName a1a
|
||||
zExplain {SEARCH TABLE a1 USING INDEX a1a (a=?)}
|
||||
nLoop 1 nVisit 1 nEst 10 zName a1bc
|
||||
nLoop 1 nVisit 1 nEst 10.0 zName a1bc
|
||||
zExplain {SEARCH TABLE a1 USING INDEX a1bc (b=?)}
|
||||
}
|
||||
|
||||
@ -203,9 +203,9 @@ do_execsql_test 3.2.1 {
|
||||
SELECT count(*) FROM a1 WHERE (a BETWEEN 4 AND 12) OR (b BETWEEN 40 AND 60)
|
||||
} {30}
|
||||
do_scanstatus_test 3.2.2 {
|
||||
nLoop 1 nVisit 9 nEst 16384 zName a1a
|
||||
nLoop 1 nVisit 9 nEst 16384.0 zName a1a
|
||||
zExplain {SEARCH TABLE a1 USING INDEX a1a (a>? AND a<?)}
|
||||
nLoop 1 nVisit 21 nEst 16384 zName a1bc
|
||||
nLoop 1 nVisit 21 nEst 16384.0 zName a1bc
|
||||
zExplain {SEARCH TABLE a1 USING INDEX a1bc (b>? AND b<?)}
|
||||
}
|
||||
|
||||
@ -214,9 +214,9 @@ do_execsql_test 3.3.1 {
|
||||
WHERE (x.a BETWEEN 4 AND 12) AND (y.b BETWEEN 1 AND 10)
|
||||
} {90}
|
||||
do_scanstatus_test 3.2.2 {
|
||||
nLoop 1 nVisit 10 nEst 16384 zName a1bc
|
||||
nLoop 1 nVisit 10 nEst 16384.0 zName a1bc
|
||||
zExplain {SEARCH TABLE a1 AS y USING COVERING INDEX a1bc (b>? AND b<?)}
|
||||
nLoop 10 nVisit 90 nEst 16384 zName a1a
|
||||
nLoop 10 nVisit 90 nEst 16384.0 zName a1a
|
||||
zExplain {SEARCH TABLE a1 AS x USING COVERING INDEX a1a (a>? AND a<?)}
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ do_execsql_test 3.4.1 {
|
||||
SELECT count(*) FROM a1 WHERE a IN (1, 5, 10, 15);
|
||||
} {4}
|
||||
do_scanstatus_test 3.4.2 {
|
||||
nLoop 1 nVisit 4 nEst 40 zName a1a
|
||||
nLoop 1 nVisit 4 nEst 40.0 zName a1a
|
||||
zExplain {SEARCH TABLE a1 USING COVERING INDEX a1a (a=?)}
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ do_execsql_test 3.4.1 {
|
||||
SELECT count(*) FROM a1 WHERE rowid IN (1, 5, 10, 15);
|
||||
} {4}
|
||||
do_scanstatus_test 3.4.2 {
|
||||
nLoop 1 nVisit 4 nEst 4 zName a1
|
||||
nLoop 1 nVisit 4 nEst 4.0 zName a1
|
||||
zExplain {SEARCH TABLE a1 USING INTEGER PRIMARY KEY (rowid=?)}
|
||||
}
|
||||
|
||||
@ -265,10 +265,10 @@ do_execsql_test 4.2 {
|
||||
}
|
||||
do_execsql_test 4.2.1 { DELETE FROM p1 WHERE x=4 }
|
||||
do_scanstatus_test 4.2.2 {
|
||||
nLoop 1 nVisit 1 nEst 1 zName sqlite_autoindex_p1_1
|
||||
nLoop 1 nVisit 1 nEst 1.0 zName sqlite_autoindex_p1_1
|
||||
zExplain {SEARCH TABLE p1 USING INDEX sqlite_autoindex_p1_1 (x=?)}
|
||||
|
||||
nLoop 1 nVisit 3 nEst 524288 zName c1 zExplain {SCAN TABLE c1}
|
||||
nLoop 1 nVisit 3 nEst 524288.0 zName c1 zExplain {SCAN TABLE c1}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -312,9 +312,9 @@ do_execsql_test 5.1.1 {
|
||||
SELECT count(*) FROM t1 WHERE a IN (SELECT b FROM t1 AS ii)
|
||||
} {2}
|
||||
do_scanstatus_test 5.1.2 {
|
||||
nLoop 1 nVisit 10 nEst 10 zName t1bc
|
||||
nLoop 1 nVisit 10 nEst 10.0 zName t1bc
|
||||
zExplain {SCAN TABLE t1 AS ii USING COVERING INDEX t1bc}
|
||||
nLoop 1 nVisit 2 nEst 8 zName sqlite_autoindex_t1_1
|
||||
nLoop 1 nVisit 2 nEst 8.0 zName sqlite_autoindex_t1_1
|
||||
zExplain {SEARCH TABLE t1 USING COVERING INDEX sqlite_autoindex_t1_1 (a=?)}
|
||||
}
|
||||
|
||||
@ -322,7 +322,7 @@ do_execsql_test 5.2.1 {
|
||||
SELECT count(*) FROM t1 WHERE a IN (0, 1)
|
||||
} {2}
|
||||
do_scanstatus_test 5.2.2 {
|
||||
nLoop 1 nVisit 2 nEst 2 zName sqlite_autoindex_t1_1
|
||||
nLoop 1 nVisit 2 nEst 2.0 zName sqlite_autoindex_t1_1
|
||||
zExplain {SEARCH TABLE t1 USING COVERING INDEX sqlite_autoindex_t1_1 (a=?)}
|
||||
}
|
||||
|
||||
@ -333,7 +333,7 @@ do_execsql_test 5.3.2 {
|
||||
SELECT count(*) FROM t2 WHERE y = 'j';
|
||||
} {19}
|
||||
do_scanstatus_test 5.3.3 {
|
||||
nLoop 1 nVisit 19 nEst 56 zName t2xy zExplain
|
||||
nLoop 1 nVisit 19 nEst 56.0 zName t2xy zExplain
|
||||
{SEARCH TABLE t2 USING COVERING INDEX t2xy (ANY(x) AND y=?)}
|
||||
}
|
||||
|
||||
@ -347,9 +347,9 @@ do_execsql_test 5.4.2 {
|
||||
SELECT count(*) FROM t1, t2 WHERE y = c;
|
||||
} {200}
|
||||
do_scanstatus_test 5.4.3 {
|
||||
nLoop 1 nVisit 10 nEst 10 zName t1bc
|
||||
nLoop 1 nVisit 10 nEst 10.0 zName t1bc
|
||||
zExplain {SCAN TABLE t1 USING COVERING INDEX t1bc}
|
||||
nLoop 10 nVisit 200 nEst 56 zName t2xy
|
||||
nLoop 10 nVisit 200 nEst 56.0 zName t2xy
|
||||
zExplain {SEARCH TABLE t2 USING COVERING INDEX t2xy (ANY(x) AND y=?)}
|
||||
}
|
||||
|
||||
@ -363,8 +363,8 @@ do_execsql_test 5.5.2 {
|
||||
SELECT count(*) FROM t1, t3 WHERE y = c;
|
||||
} {200}
|
||||
do_scanstatus_test 5.5.3 {
|
||||
nLoop 1 nVisit 501 nEst 480 zName t3 zExplain {SCAN TABLE t3}
|
||||
nLoop 501 nVisit 200 nEst 20 zName auto-index zExplain
|
||||
nLoop 1 nVisit 501 nEst 480.0 zName t3 zExplain {SCAN TABLE t3}
|
||||
nLoop 501 nVisit 200 nEst 20.0 zName auto-index zExplain
|
||||
{SEARCH TABLE t1 USING AUTOMATIC COVERING INDEX (c=?)}
|
||||
}
|
||||
|
||||
@ -389,7 +389,7 @@ ifcapable fts3 {
|
||||
SELECT count(*) FROM ft1 WHERE ft1 MATCH 'd'
|
||||
} {6}
|
||||
do_scanstatus_test 6.1.2 {
|
||||
nLoop 1 nVisit 6 nEst 24 zName ft1 zExplain
|
||||
nLoop 1 nVisit 6 nEst 24.0 zName ft1 zExplain
|
||||
{SCAN TABLE ft1 VIRTUAL TABLE INDEX 3:}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user