diff options
author | drh <drh@noemail.net> | 2018-12-24 20:21:06 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-12-24 20:21:06 +0000 |
commit | bd462bcc10bb1545d39359ff29cb521819ab656d (patch) | |
tree | fca095cfaad919a152ed5c1a89fa5d8937a1b789 /src/vdbeaux.c | |
parent | a599e150caa88cfc9a7c27cf7bd79fe93b8ea7d8 (diff) | |
download | sqlite-bd462bcc10bb1545d39359ff29cb521819ab656d.tar.gz sqlite-bd462bcc10bb1545d39359ff29cb521819ab656d.zip |
Improvements to EXPLAIN QUERY PLAN formatting. The MULTI-INDEX OR now shows
a separate "INDEX" subtree for each index. SCALAR SUBQUERY entries provide
a subquery number that is related back to the .selecttrace output.
FossilOrigin-Name: 7153552bac51295c56a1c42ca79d57195851e232509f9e9610375692f48c7e86
Diffstat (limited to 'src/vdbeaux.c')
-rw-r--r-- | src/vdbeaux.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 5225cbc73..286d4e92b 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -350,13 +350,27 @@ int sqlite3VdbeExplainParent(Parse *pParse){ } /* -** Add a new OP_Explain opcode. +** Set a debugger breakpoint on the following routine in order to +** monitor the EXPLAIN QUERY PLAN code generation. +*/ +#if defined(SQLITE_DEBUG) +void sqlite3ExplainBreakpoint(const char *z1, const char *z2){ + (void)z1; + (void)z2; +} +#endif + +/* +** Add a new OP_ opcode. ** ** If the bPush flag is true, then make this opcode the parent for ** subsequent Explains until sqlite3VdbeExplainPop() is called. */ void sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt, ...){ - if( pParse->explain==2 ){ +#if !defined(SQLITE_DEBUG) + if( pParse->explain==2 ) +#endif + { char *zMsg; Vdbe *v; va_list ap; @@ -368,7 +382,10 @@ void sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt, ...){ iThis = v->nOp; sqlite3VdbeAddOp4(v, OP_Explain, iThis, pParse->addrExplain, 0, zMsg, P4_DYNAMIC); - if( bPush) pParse->addrExplain = iThis; + sqlite3ExplainBreakpoint(bPush?"PUSH":"", sqlite3VdbeGetOp(v,-1)->p4.z); + if( bPush){ + pParse->addrExplain = iThis; + } } } @@ -376,6 +393,7 @@ void sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt, ...){ ** Pop the EXPLAIN QUERY PLAN stack one level. */ void sqlite3VdbeExplainPop(Parse *pParse){ + sqlite3ExplainBreakpoint("POP", 0); pParse->addrExplain = sqlite3VdbeExplainParent(pParse); } #endif /* SQLITE_OMIT_EXPLAIN */ |