Improved EXPLAIN indentation of a loop in the ANALYZE logic for STAT4.
Mark the not-found jump of a seek operation in that loop as never taken. FossilOrigin-Name: 0a4200f95cf46ad620b9fd91f4444114a0c74730
This commit is contained in:
parent
0df163a9f0
commit
fe70510aa7
18
manifest
18
manifest
@ -1,5 +1,5 @@
|
||||
C Remove\sa\sbranch\sthat\sis\snever\staken\sfrom\swhere.c.
|
||||
D 2014-03-06T12:36:26.240
|
||||
C Improved\sEXPLAIN\sindentation\sof\sa\sloop\sin\sthe\sANALYZE\slogic\sfor\sSTAT4.\nMark\sthe\snot-found\sjump\sof\sa\sseek\soperation\sin\sthat\sloop\sas\snever\staken.
|
||||
D 2014-03-06T13:38:37.861
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -157,7 +157,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
|
||||
F sqlite3.1 3d8b83c91651f53472ca17599dae3457b8b89494
|
||||
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
|
||||
F src/alter.c 5d99edbac5bc416032772b723ee30182ee6e5de0
|
||||
F src/analyze.c 69761e1677142d180a9f55250dee2952f45e4793
|
||||
F src/analyze.c 663e0b291d27eb03c9fd6b421e2d61ba348a2389
|
||||
F src/attach.c 3801129015ef59d76bf23c95ef9b0069d18a0c52
|
||||
F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
|
||||
F src/backup.c a729e63cf5cd1829507cb7b8e89f99b95141bb53
|
||||
@ -217,7 +217,7 @@ F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece
|
||||
F src/resolve.c 273d5f47c4e2c05b2d3d2bffeda939551ab59e66
|
||||
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
|
||||
F src/select.c 0adf172d33cc610ff5ffe26edfd2ba67c3551655
|
||||
F src/shell.c c0cbbbe5eec0923caafd1b9593925f8b241addb8
|
||||
F src/shell.c bab4de12b441369491812ecc93212ff4deda68fa
|
||||
F src/sqlite.h.in a2ef671f92747a5a1c8a47bad5c585a8dd9eca80
|
||||
F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e
|
||||
F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc
|
||||
@ -277,7 +277,7 @@ F src/update.c 5b3e74a03b3811e586b4f2b4cbd7c49f01c93115
|
||||
F src/utf.c 6dc9ec9f1b3db43ae8ba0365377f11df1ee4c01c
|
||||
F src/util.c c46c90459ef9bdc0c6c73803cf4c55425b4771cf
|
||||
F src/vacuum.c 3728d74919d4fb1356f9e9a13e27773db60b7179
|
||||
F src/vdbe.c b2ca9b8e3a47a3bcecdb2b551279a2ba750a19e5
|
||||
F src/vdbe.c 5f0fffa9bf49a90c05dc3d46d8217603fd0ee00e
|
||||
F src/vdbe.h d189f92468a17a6f04daeec9df3b767f50557b21
|
||||
F src/vdbeInt.h e54fc4f289fce48e81b3371128446033d097733b
|
||||
F src/vdbeapi.c 0ed6053f947edd0b30f64ce5aeb811872a3450a4
|
||||
@ -1155,7 +1155,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
|
||||
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
|
||||
P c87d8e07ec596d5f0ef3003cfeb226d4b7c49549
|
||||
R 8a41ab31fe82e4eb8dd3f6f960d87359
|
||||
U dan
|
||||
Z 9504b4a4d2685ecc17b4e7b160b2fd5f
|
||||
P 4a4997221f3d61c1411a993053b40c787beea736
|
||||
R 6c77c921c71ee968c47f10dbbbd337e5
|
||||
U drh
|
||||
Z 43128f0b9615c8a6ed241332450c076a
|
||||
|
@ -1 +1 @@
|
||||
4a4997221f3d61c1411a993053b40c787beea736
|
||||
0a4200f95cf46ad620b9fd91f4444114a0c74730
|
@ -1178,7 +1178,10 @@ static void analyzeOneTable(
|
||||
callStatGet(v, regStat4, STAT_GET_NLT, regLt);
|
||||
callStatGet(v, regStat4, STAT_GET_NDLT, regDLt);
|
||||
sqlite3VdbeAddOp4Int(v, seekOp, iTabCur, addrNext, regSampleRowid, 0);
|
||||
VdbeCoverage(v);
|
||||
/* We know that the regSampleRowid row exists because it was read by
|
||||
** the previous loop. Thus the not-found jump of seekOp will never
|
||||
** be taken */
|
||||
VdbeCoverageNeverTaken(v);
|
||||
#ifdef SQLITE_ENABLE_STAT3
|
||||
sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur,
|
||||
pIdx->aiColumn[0], regSample);
|
||||
@ -1192,7 +1195,7 @@ static void analyzeOneTable(
|
||||
sqlite3VdbeAddOp3(v, OP_MakeRecord, regTabname, 6, regTemp);
|
||||
sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur+1, regNewRowid);
|
||||
sqlite3VdbeAddOp3(v, OP_Insert, iStatCur+1, regTemp, regNewRowid);
|
||||
sqlite3VdbeAddOp2(v, OP_Goto, 0, addrNext);
|
||||
sqlite3VdbeAddOp2(v, OP_Goto, 1, addrNext); /* P1==1 for end-of-loop */
|
||||
sqlite3VdbeJumpHere(v, addrIsNull);
|
||||
}
|
||||
#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */
|
||||
|
@ -1184,6 +1184,7 @@ static int str_in_array(const char *zStr, const char **azArray){
|
||||
** * For each "Goto", if the jump destination is earlier in the program
|
||||
** and ends on one of:
|
||||
** Yield SeekGt SeekLt RowSetRead Rewind
|
||||
** or if the P1 parameter is one instead of zero,
|
||||
** then indent all opcodes between the earlier instruction
|
||||
** and "Goto" by 2 spaces.
|
||||
*/
|
||||
@ -1231,7 +1232,9 @@ static void explain_data_prepare(struct callback_data *p, sqlite3_stmt *pSql){
|
||||
if( str_in_array(zOp, azNext) ){
|
||||
for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2;
|
||||
}
|
||||
if( str_in_array(zOp, azGoto) && p2op<p->nIndent && abYield[p2op] ){
|
||||
if( str_in_array(zOp, azGoto) && p2op<p->nIndent
|
||||
&& (abYield[p2op] || sqlite3_column_int(pSql, 2))
|
||||
){
|
||||
for(i=p2op+1; i<iOp; i++) p->aiIndent[i] += 2;
|
||||
}
|
||||
}
|
||||
|
@ -671,6 +671,11 @@ int sqlite3VdbeExec(
|
||||
** The next instruction executed will be
|
||||
** the one at index P2 from the beginning of
|
||||
** the program.
|
||||
**
|
||||
** The P1 parameter is not actually used by this opcode. However, it
|
||||
** is sometimes set to 1 instead of 0 as a hint to the command-line shell
|
||||
** that this Goto is the bottom of a loop and that the lines from P2 down
|
||||
** to the current line should be indented for EXPLAIN output.
|
||||
*/
|
||||
case OP_Goto: { /* jump */
|
||||
pc = pOp->p2 - 1;
|
||||
|
Loading…
Reference in New Issue
Block a user