-C Begin\sreengineering\sthe\sEXPLAIN\sQUERY\sPLAN\sfunction\sto\sprovide\smore\nintuitive\soutput.
-D 2018-05-02T00:33:43.157
+C Improvements\sto\sthe\sEQP\sdisplay\sfor\scompound\sselect\sstatements.
+D 2018-05-02T02:22:22.993
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 5ce9343cba9c189046f1afe6d2bcc1f68079439febc05267b98aec6ecc752439
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 6415381a0e9d22c0e7cba33ca4a53f81474190862f5d4838190f5eb5b0b47bc9
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
-F src/select.c 8481fa6ec8bb3b24465da8e81438d4d85056d69232f501c153ab8402409c8619
+F src/select.c 41962df2f21593db4eb5e0d7d8f15848b9ebd3ffed9b7584677033a8db37223b
F src/shell.c.in 29309f2ab656c8817fbc3b7910b9af8464557b91cba75277a03669399c8e2730
F src/sqlite.h.in d669de545f18f2f01362de02e309cd7f15185958c71bac8f53cd5438b46d2bea
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 853f3163597b9946c0cbeb808ea6fd33a0cf48ae6b8f4459c4165db377f33a9e
-R 4157eb92d30294276c327d965c794c5a
-T *branch * rework-EQP
-T *sym-rework-EQP *
-T -sym-trunk *
+P 70b48a7972dfbb44af3ccd8ccd830e984bec88d80a78b3566a5de86a16e7fc14
+R 21b35e2f4fb3267c4b0452fc48ac12e8
U drh
-Z 60e64f1bce0fa6f0f61a0e5e536f0823
+Z 26b206c16e8cc64ca80991a86c32cf32
# define explainSetInteger(y,z)
#endif
-#if !defined(SQLITE_OMIT_EXPLAIN) && !defined(SQLITE_OMIT_COMPOUND_SELECT)
-/*
-** Unless an "EXPLAIN QUERY PLAN" command is being processed, this function
-** is a no-op. Otherwise, it adds a single row of output to the EQP result,
-** where the caption is of one of the two forms:
-**
-** "COMPOSITE (op)"
-** "COMPOSITE USING TEMP B-TREE (op)"
-**
-** where op is the text representation of the parameter
-** of the same name. The parameter "op" must be one of TK_UNION, TK_EXCEPT,
-** TK_INTERSECT or TK_ALL. The first form is used if argument bUseTmp is
-** false, or the second form if it is true.
-*/
-static void explainComposite(
- Parse *pParse, /* Parse context */
- int op, /* One of TK_UNION, TK_EXCEPT etc. */
- int bUseTmp /* True if a temp table was used */
-){
- assert( op==TK_UNION || op==TK_EXCEPT || op==TK_INTERSECT || op==TK_ALL );
- ExplainQueryPlan((pParse, 1, "COMPOUND %s(%s)",
- bUseTmp?"USING TEMP B-TREE ":"", selectOpName(op)));
-}
-#else
-/* No-op versions of the explainXXX() functions and macros. */
-# define explainComposite(v,y,z)
-#endif
/*
** If the inner loop was generated using a non-null pOrderBy argument,
return multiSelectOrderBy(pParse, p, pDest);
}else
+#ifndef SQLITE_OMIT_EXPLAIN
+ if( pPrior->pPrior==0 ){
+ ExplainQueryPlan((pParse, 1, "COMPOUND QUERY"));
+ ExplainQueryPlan((pParse, 1, "LEFT-MOST SUBQUERY"));
+ ExplainQueryPlanSetId(pParse, pPrior);
+ }
+#endif
+
/* Generate code for the left and right SELECT statements.
*/
- explainComposite(pParse, p->op, p->op!=TK_ALL);
switch( p->op ){
case TK_ALL: {
int addr = 0;
p->iLimit, p->iOffset+1, p->iOffset);
}
}
+ ExplainQueryPlan((pParse, 1, "UNION ALL"));
+ ExplainQueryPlanSetId(pParse, p);
rc = sqlite3Select(pParse, p, &dest);
testcase( rc!=SQLITE_OK );
pDelete = p->pPrior;
pLimit = p->pLimit;
p->pLimit = 0;
uniondest.eDest = op;
+ ExplainQueryPlan((pParse, 1, "%s USING TEMP B-TREE",
+ selectOpName(p->op)));
+ ExplainQueryPlanSetId(pParse, p);
rc = sqlite3Select(pParse, p, &uniondest);
testcase( rc!=SQLITE_OK );
/* Query flattening in sqlite3Select() might refill p->pOrderBy.
pLimit = p->pLimit;
p->pLimit = 0;
intersectdest.iSDParm = tab2;
+ ExplainQueryPlan((pParse, 1, "%s USING TEMP B-TREE",
+ selectOpName(p->op)));
+ ExplainQueryPlanSetId(pParse, p);
rc = sqlite3Select(pParse, p, &intersectdest);
testcase( rc!=SQLITE_OK );
pDelete = p->pPrior;
}
}
- ExplainQueryPlanPop(pParse);
+#ifndef SQLITE_OMIT_EXPLAIN
+ if( p->pNext==0 ){
+ ExplainQueryPlanPop(pParse);
+ }
+#endif
/* Compute collating sequences used by
** temporary tables needed to implement the compound select.
regOutB = ++pParse->nMem;
sqlite3SelectDestInit(&destA, SRT_Coroutine, regAddrA);
sqlite3SelectDestInit(&destB, SRT_Coroutine, regAddrB);
- explainComposite(pParse, p->op, 0);
+ ExplainQueryPlan((pParse, 1, "MERGE (%s)", selectOpName(p->op)));
/* Generate a coroutine to evaluate the SELECT statement to the
** left of the compound operator - the "A" select.
addr1 = sqlite3VdbeAddOp3(v, OP_InitCoroutine, regAddrA, 0, addrSelectA);
VdbeComment((v, "left SELECT"));
pPrior->iLimit = regLimitA;
+ ExplainQueryPlan((pParse, 1, "LEFT"));
+ ExplainQueryPlanSetId(pParse, pPrior);
sqlite3Select(pParse, pPrior, &destA);
sqlite3VdbeEndCoroutine(v, regAddrA);
sqlite3VdbeJumpHere(v, addr1);
savedOffset = p->iOffset;
p->iLimit = regLimitB;
p->iOffset = 0;
+ ExplainQueryPlan((pParse, 1, "RIGHT"));
+ ExplainQueryPlanSetId(pParse, p);
sqlite3Select(pParse, p, &destB);
p->iLimit = savedLimit;
p->iOffset = savedOffset;
}
if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
memset(&sAggInfo, 0, sizeof(sAggInfo));
-#ifndef SQLITE_OMIT_EXPLAIN
- if( p->iSelectId==0 && pParse->addrExplain ){
- ExplainQueryPlan((pParse, 1, "SUBQUERY"));
- p->iSelectId = pParse->addrExplain;
- }
-#endif
#if SELECTTRACE_ENABLED
SELECTTRACE(1,pParse,p, ("begin processing:\n", pParse->addrExplain));
if( sqlite3SelectTrace & 0x100 ){
sqlite3TreeViewSelect(0, p, 0);
}
#endif
- sqlite3VdbeExplainPop(pParse);
+ if( p->pNext==0 ) ExplainQueryPlanPop(pParse);
return rc;
}
#endif