Rename the SELECTTRACE macro to TREETRACE, so that is corresponds to the new
CLI command. Renumber all of the bits in the bitmask used to enable various kinds of tracing, and add a trace bitmap decoder in sqliteInt.h. Changes to debugging logic only. No (intentional) changes to production code. FossilOrigin-Name: 8036445a36d9d982c1305935e7e37367bdf9e466b923eb6286b52524802e3ccd
This commit is contained in:
parent
c9b7d943ad
commit
5d7aef16bf
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\sthe\serror\smessage\sin\sthe\sCLI\sfor\s"no\ssuch\sVFS".\n[forum:/info/1217fdd6b3|Forum\spost\s1217fdd6b3].
|
||||
D 2022-11-22T18:24:07.441
|
||||
C Rename\sthe\sSELECTTRACE\smacro\sto\sTREETRACE,\sso\sthat\sis\scorresponds\sto\sthe\snew\nCLI\scommand.\s\sRenumber\sall\sof\sthe\sbits\sin\sthe\sbitmask\sused\sto\senable\nvarious\skinds\sof\stracing,\sand\sadd\sa\strace\sbitmap\sdecoder\sin\ssqliteInt.h.\nChanges\sto\sdebugging\slogic\sonly.\s\sNo\s(intentional)\schanges\sto\sproduction\scode.
|
||||
D 2022-11-22T19:49:16.908
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -641,12 +641,12 @@ F src/printf.c e99ee9741e79ae3873458146f59644276657340385ade4e76a5f5d1c25793764
|
||||
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
|
||||
F src/resolve.c efea4e5fbecfd6d0a9071b0be0d952620991673391b6ffaaf4c277b0bb674633
|
||||
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
|
||||
F src/select.c 3fc60a8f0b54db15e86584c5fd68dbf63c20fe86886a39267ce7dfc17b68853d
|
||||
F src/select.c 4c48373abb4e67129c36bc15d1f5a99a0dfd9534afeb539a2169a09ae91ccec9
|
||||
F src/shell.c.in 7d1705f139e6762e8c0fe254a8ebf3ab77aec6d8366f033cdd5f5ebadefbbb20
|
||||
F src/sqlite.h.in 100fc660c2f19961b8ed8437b9d53d687de2f8eb2b96437ec6da216adcb643ca
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h c4b9fa7a7e2bcdf850cfeb4b8a91d5ec47b7a00033bc996fd2ee96cbf2741f5f
|
||||
F src/sqliteInt.h 42bcbb6cebef64c99068e7bc141a2541d40d65c7c26a9ca5ada4d83ca353555d
|
||||
F src/sqliteInt.h 3bdf90cb7578dfccfd3e8c0f9c8b0eecc5280f5813891d6b3016cd6f1bdb1f7e
|
||||
F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
|
||||
F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749
|
||||
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
|
||||
@ -732,7 +732,7 @@ F src/where.c ea0f518df9e00aa44013a1d384090b4b3a499ee11d4daa0a7d99c4eb9f7ab4ba
|
||||
F src/whereInt.h df0c79388c0b71b4a91f480d02791679fe0345d40410435c541c8893e95a4d3f
|
||||
F src/wherecode.c 133a94f82858787217d073143617df19e4a6a7d0b771a1519f957608109ad5a5
|
||||
F src/whereexpr.c 05295b44b54eea76d1ba766f0908928d0e20e990c249344c9521454d3d09c7ae
|
||||
F src/window.c 928e215840e2f2d9a2746e018c9643ef42c66c4ab6630ef0df7fa388fa145e86
|
||||
F src/window.c 14836767adb26573b50f528eb37f8b1336f2c430ab38de7cead1e5c546bb4d8c
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867de90627
|
||||
F test/affinity3.test b5c19d504dec222c0dc66642673d23dce915d35737b68e74d9f237b80493eb53
|
||||
@ -2059,8 +2059,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 6d5dc9eed54b7d883aa7dbe2eb5ff17d2a703eabdb7d548a27cccc1fe5addb4a
|
||||
R c32ff36f085986b819f258da8a8464b1
|
||||
P 861af465fda8485dfff143dc45c659b884d826aaec2ebaa941566404d1fe427b
|
||||
R 513d506718a1d19eb8b1625991fbf39f
|
||||
U drh
|
||||
Z f12a671d42ea42f2f1054a78088f03c4
|
||||
Z 151ecb78555215509ebdea4705787b10
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
861af465fda8485dfff143dc45c659b884d826aaec2ebaa941566404d1fe427b
|
||||
8036445a36d9d982c1305935e7e37367bdf9e466b923eb6286b52524802e3ccd
|
104
src/select.c
104
src/select.c
@ -2091,7 +2091,7 @@ void sqlite3GenerateColumnNames(
|
||||
if( pParse->colNamesSet ) return;
|
||||
/* Column names are determined by the left-most term of a compound select */
|
||||
while( pSelect->pPrior ) pSelect = pSelect->pPrior;
|
||||
SELECTTRACE(1,pParse,pSelect,("generating column names\n"));
|
||||
TREETRACE(0x80,pParse,pSelect,("generating column names\n"));
|
||||
pTabList = pSelect->pSrc;
|
||||
pEList = pSelect->pEList;
|
||||
assert( v!=0 );
|
||||
@ -2877,7 +2877,7 @@ static int multiSelect(
|
||||
pPrior->iLimit = p->iLimit;
|
||||
pPrior->iOffset = p->iOffset;
|
||||
pPrior->pLimit = p->pLimit;
|
||||
SELECTTRACE(1, pParse, p, ("multiSelect UNION ALL left...\n"));
|
||||
TREETRACE(0x200, pParse, p, ("multiSelect UNION ALL left...\n"));
|
||||
rc = sqlite3Select(pParse, pPrior, &dest);
|
||||
pPrior->pLimit = 0;
|
||||
if( rc ){
|
||||
@ -2895,7 +2895,7 @@ static int multiSelect(
|
||||
}
|
||||
}
|
||||
ExplainQueryPlan((pParse, 1, "UNION ALL"));
|
||||
SELECTTRACE(1, pParse, p, ("multiSelect UNION ALL right...\n"));
|
||||
TREETRACE(0x200, pParse, p, ("multiSelect UNION ALL right...\n"));
|
||||
rc = sqlite3Select(pParse, p, &dest);
|
||||
testcase( rc!=SQLITE_OK );
|
||||
pDelete = p->pPrior;
|
||||
@ -2948,7 +2948,7 @@ static int multiSelect(
|
||||
*/
|
||||
assert( !pPrior->pOrderBy );
|
||||
sqlite3SelectDestInit(&uniondest, priorOp, unionTab);
|
||||
SELECTTRACE(1, pParse, p, ("multiSelect EXCEPT/UNION left...\n"));
|
||||
TREETRACE(0x200, pParse, p, ("multiSelect EXCEPT/UNION left...\n"));
|
||||
rc = sqlite3Select(pParse, pPrior, &uniondest);
|
||||
if( rc ){
|
||||
goto multi_select_end;
|
||||
@ -2968,7 +2968,7 @@ static int multiSelect(
|
||||
uniondest.eDest = op;
|
||||
ExplainQueryPlan((pParse, 1, "%s USING TEMP B-TREE",
|
||||
sqlite3SelectOpName(p->op)));
|
||||
SELECTTRACE(1, pParse, p, ("multiSelect EXCEPT/UNION right...\n"));
|
||||
TREETRACE(0x200, pParse, p, ("multiSelect EXCEPT/UNION right...\n"));
|
||||
rc = sqlite3Select(pParse, p, &uniondest);
|
||||
testcase( rc!=SQLITE_OK );
|
||||
assert( p->pOrderBy==0 );
|
||||
@ -3029,7 +3029,7 @@ static int multiSelect(
|
||||
/* Code the SELECTs to our left into temporary table "tab1".
|
||||
*/
|
||||
sqlite3SelectDestInit(&intersectdest, SRT_Union, tab1);
|
||||
SELECTTRACE(1, pParse, p, ("multiSelect INTERSECT left...\n"));
|
||||
TREETRACE(0x400, pParse, p, ("multiSelect INTERSECT left...\n"));
|
||||
rc = sqlite3Select(pParse, pPrior, &intersectdest);
|
||||
if( rc ){
|
||||
goto multi_select_end;
|
||||
@ -3046,7 +3046,7 @@ static int multiSelect(
|
||||
intersectdest.iSDParm = tab2;
|
||||
ExplainQueryPlan((pParse, 1, "%s USING TEMP B-TREE",
|
||||
sqlite3SelectOpName(p->op)));
|
||||
SELECTTRACE(1, pParse, p, ("multiSelect INTERSECT right...\n"));
|
||||
TREETRACE(0x400, pParse, p, ("multiSelect INTERSECT right...\n"));
|
||||
rc = sqlite3Select(pParse, p, &intersectdest);
|
||||
testcase( rc!=SQLITE_OK );
|
||||
pDelete = p->pPrior;
|
||||
@ -4395,7 +4395,7 @@ static int flattenSubquery(
|
||||
}
|
||||
|
||||
/***** If we reach this point, flattening is permitted. *****/
|
||||
SELECTTRACE(1,pParse,p,("flatten %u.%p from term %d\n",
|
||||
TREETRACE(0x4,pParse,p,("flatten %u.%p from term %d\n",
|
||||
pSub->selId, pSub, iFrom));
|
||||
|
||||
/* Authorize the subquery */
|
||||
@ -4474,7 +4474,7 @@ static int flattenSubquery(
|
||||
if( pPrior ) pPrior->pNext = pNew;
|
||||
pNew->pNext = p;
|
||||
p->pPrior = pNew;
|
||||
SELECTTRACE(2,pParse,p,("compound-subquery flattener"
|
||||
TREETRACE(0x4,pParse,p,("compound-subquery flattener"
|
||||
" creates %u as peer\n",pNew->selId));
|
||||
}
|
||||
assert( pSubitem->pSelect==0 );
|
||||
@ -4654,8 +4654,8 @@ static int flattenSubquery(
|
||||
sqlite3SelectDelete(db, pSub1);
|
||||
|
||||
#if TREETRACE_ENABLED
|
||||
if( sqlite3TreeTrace & 0x100 ){
|
||||
SELECTTRACE(0x100,pParse,p,("After flattening:\n"));
|
||||
if( sqlite3TreeTrace & 0x4 ){
|
||||
TREETRACE(0x4,pParse,p,("After flattening:\n"));
|
||||
sqlite3TreeViewSelect(0, p, 0);
|
||||
}
|
||||
#endif
|
||||
@ -6068,8 +6068,8 @@ static int selectExpander(Walker *pWalker, Select *p){
|
||||
}
|
||||
}
|
||||
#if TREETRACE_ENABLED
|
||||
if( sqlite3TreeTrace & 0x100 ){
|
||||
SELECTTRACE(0x100,pParse,p,("After result-set wildcard expansion:\n"));
|
||||
if( sqlite3TreeTrace & 0x8 ){
|
||||
TREETRACE(0x8,pParse,p,("After result-set wildcard expansion:\n"));
|
||||
sqlite3TreeViewSelect(0, p, 0);
|
||||
}
|
||||
#endif
|
||||
@ -6465,7 +6465,7 @@ static void havingToWhere(Parse *pParse, Select *p){
|
||||
sqlite3WalkExpr(&sWalker, p->pHaving);
|
||||
#if TREETRACE_ENABLED
|
||||
if( sWalker.eCode && (sqlite3TreeTrace & 0x100)!=0 ){
|
||||
SELECTTRACE(0x100,pParse,p,("Move HAVING terms into WHERE:\n"));
|
||||
TREETRACE(0x100,pParse,p,("Move HAVING terms into WHERE:\n"));
|
||||
sqlite3TreeViewSelect(0, p, 0);
|
||||
}
|
||||
#endif
|
||||
@ -6597,8 +6597,8 @@ static int countOfViewOptimization(Parse *pParse, Select *p){
|
||||
p->selFlags &= ~SF_Aggregate;
|
||||
|
||||
#if TREETRACE_ENABLED
|
||||
if( sqlite3TreeTrace & 0x400 ){
|
||||
SELECTTRACE(0x400,pParse,p,("After count-of-view optimization:\n"));
|
||||
if( sqlite3TreeTrace & 0x200 ){
|
||||
TREETRACE(0x200,pParse,p,("After count-of-view optimization:\n"));
|
||||
sqlite3TreeViewSelect(0, p, 0);
|
||||
}
|
||||
#endif
|
||||
@ -6698,8 +6698,8 @@ int sqlite3Select(
|
||||
assert( db->mallocFailed==0 );
|
||||
if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
|
||||
#if TREETRACE_ENABLED
|
||||
SELECTTRACE(1,pParse,p, ("begin processing:\n", pParse->addrExplain));
|
||||
if( sqlite3TreeTrace & 0x10100 ){
|
||||
TREETRACE(0x1,pParse,p, ("begin processing:\n", pParse->addrExplain));
|
||||
if( sqlite3TreeTrace & 0x10000 ){
|
||||
if( (sqlite3TreeTrace & 0x10001)==0x10000 ){
|
||||
sqlite3TreeViewLine(0, "In sqlite3Select() at %s:%d",
|
||||
__FILE__, __LINE__);
|
||||
@ -6719,8 +6719,8 @@ int sqlite3Select(
|
||||
/* All of these destinations are also able to ignore the ORDER BY clause */
|
||||
if( p->pOrderBy ){
|
||||
#if TREETRACE_ENABLED
|
||||
SELECTTRACE(1,pParse,p, ("dropping superfluous ORDER BY:\n"));
|
||||
if( sqlite3TreeTrace & 0x100 ){
|
||||
TREETRACE(0x800,pParse,p, ("dropping superfluous ORDER BY:\n"));
|
||||
if( sqlite3TreeTrace & 0x800 ){
|
||||
sqlite3TreeViewExprList(0, p->pOrderBy, 0, "ORDERBY");
|
||||
}
|
||||
#endif
|
||||
@ -6740,8 +6740,8 @@ int sqlite3Select(
|
||||
assert( db->mallocFailed==0 );
|
||||
assert( p->pEList!=0 );
|
||||
#if TREETRACE_ENABLED
|
||||
if( sqlite3TreeTrace & 0x104 ){
|
||||
SELECTTRACE(0x104,pParse,p, ("after name resolution:\n"));
|
||||
if( sqlite3TreeTrace & 0x10 ){
|
||||
TREETRACE(0x10,pParse,p, ("after name resolution:\n"));
|
||||
sqlite3TreeViewSelect(0, p, 0);
|
||||
}
|
||||
#endif
|
||||
@ -6782,8 +6782,8 @@ int sqlite3Select(
|
||||
goto select_end;
|
||||
}
|
||||
#if TREETRACE_ENABLED
|
||||
if( p->pWin && (sqlite3TreeTrace & 0x108)!=0 ){
|
||||
SELECTTRACE(0x104,pParse,p, ("after window rewrite:\n"));
|
||||
if( p->pWin && (sqlite3TreeTrace & 0x40)!=0 ){
|
||||
TREETRACE(0x40,pParse,p, ("after window rewrite:\n"));
|
||||
sqlite3TreeViewSelect(0, p, 0);
|
||||
}
|
||||
#endif
|
||||
@ -6814,7 +6814,7 @@ int sqlite3Select(
|
||||
&& sqlite3ExprImpliesNonNullRow(p->pWhere, pItem->iCursor)
|
||||
&& OptimizationEnabled(db, SQLITE_SimplifyJoin)
|
||||
){
|
||||
SELECTTRACE(0x100,pParse,p,
|
||||
TREETRACE(0x1000,pParse,p,
|
||||
("LEFT-JOIN simplifies to JOIN on term %d\n",i));
|
||||
pItem->fg.jointype &= ~(JT_LEFT|JT_OUTER);
|
||||
assert( pItem->iCursor>=0 );
|
||||
@ -6870,7 +6870,7 @@ int sqlite3Select(
|
||||
&& (p->selFlags & SF_OrderByReqd)==0 /* Condition (3) and (4) */
|
||||
&& OptimizationEnabled(db, SQLITE_OmitOrderBy)
|
||||
){
|
||||
SELECTTRACE(0x100,pParse,p,
|
||||
TREETRACE(0x800,pParse,p,
|
||||
("omit superfluous ORDER BY on %r FROM-clause subquery\n",i+1));
|
||||
sqlite3ParserAddCleanup(pParse,
|
||||
(void(*)(sqlite3*,void*))sqlite3ExprListDelete,
|
||||
@ -6925,8 +6925,8 @@ int sqlite3Select(
|
||||
if( p->pPrior ){
|
||||
rc = multiSelect(pParse, p, pDest);
|
||||
#if TREETRACE_ENABLED
|
||||
SELECTTRACE(0x1,pParse,p,("end compound-select processing\n"));
|
||||
if( (sqlite3TreeTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
|
||||
TREETRACE(0x400,pParse,p,("end compound-select processing\n"));
|
||||
if( (sqlite3TreeTrace & 0x400)!=0 && ExplainQueryPlanParent(pParse)==0 ){
|
||||
sqlite3TreeViewSelect(0, p, 0);
|
||||
}
|
||||
#endif
|
||||
@ -6946,13 +6946,13 @@ int sqlite3Select(
|
||||
&& propagateConstants(pParse, p)
|
||||
){
|
||||
#if TREETRACE_ENABLED
|
||||
if( sqlite3TreeTrace & 0x100 ){
|
||||
SELECTTRACE(0x100,pParse,p,("After constant propagation:\n"));
|
||||
if( sqlite3TreeTrace & 0x2000 ){
|
||||
TREETRACE(0x2000,pParse,p,("After constant propagation:\n"));
|
||||
sqlite3TreeViewSelect(0, p, 0);
|
||||
}
|
||||
#endif
|
||||
}else{
|
||||
SELECTTRACE(0x100,pParse,p,("Constant propagation not helpful\n"));
|
||||
TREETRACE(0x2000,pParse,p,("Constant propagation not helpful\n"));
|
||||
}
|
||||
|
||||
#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
|
||||
@ -7025,15 +7025,15 @@ int sqlite3Select(
|
||||
&& pushDownWhereTerms(pParse, pSub, p->pWhere, pItem)
|
||||
){
|
||||
#if TREETRACE_ENABLED
|
||||
if( sqlite3TreeTrace & 0x100 ){
|
||||
SELECTTRACE(0x100,pParse,p,
|
||||
if( sqlite3TreeTrace & 0x4000 ){
|
||||
TREETRACE(0x4000,pParse,p,
|
||||
("After WHERE-clause push-down into subquery %d:\n", pSub->selId));
|
||||
sqlite3TreeViewSelect(0, p, 0);
|
||||
}
|
||||
#endif
|
||||
assert( pItem->pSelect && (pItem->pSelect->selFlags & SF_PushDown)!=0 );
|
||||
}else{
|
||||
SELECTTRACE(0x100,pParse,p,("Push-down not possible\n"));
|
||||
TREETRACE(0x4000,pParse,p,("Push-down not possible\n"));
|
||||
}
|
||||
|
||||
zSavedAuthContext = pParse->zAuthContext;
|
||||
@ -7148,8 +7148,8 @@ int sqlite3Select(
|
||||
sDistinct.isTnct = (p->selFlags & SF_Distinct)!=0;
|
||||
|
||||
#if TREETRACE_ENABLED
|
||||
if( sqlite3TreeTrace & 0x400 ){
|
||||
SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n"));
|
||||
if( sqlite3TreeTrace & 0x8000 ){
|
||||
TREETRACE(0x8000,pParse,p,("After all FROM-clause analysis:\n"));
|
||||
sqlite3TreeViewSelect(0, p, 0);
|
||||
}
|
||||
#endif
|
||||
@ -7185,8 +7185,8 @@ int sqlite3Select(
|
||||
sDistinct.isTnct = 2;
|
||||
|
||||
#if TREETRACE_ENABLED
|
||||
if( sqlite3TreeTrace & 0x400 ){
|
||||
SELECTTRACE(0x400,pParse,p,("Transform DISTINCT into GROUP BY:\n"));
|
||||
if( sqlite3TreeTrace & 0x20000 ){
|
||||
TREETRACE(0x20000,pParse,p,("Transform DISTINCT into GROUP BY:\n"));
|
||||
sqlite3TreeViewSelect(0, p, 0);
|
||||
}
|
||||
#endif
|
||||
@ -7272,7 +7272,7 @@ int sqlite3Select(
|
||||
|
||||
|
||||
/* Begin the database scan. */
|
||||
SELECTTRACE(1,pParse,p,("WhereBegin\n"));
|
||||
TREETRACE(0x2,pParse,p,("WhereBegin\n"));
|
||||
pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, sSort.pOrderBy,
|
||||
p->pEList, p, wctrlFlags, p->nSelectRow);
|
||||
if( pWInfo==0 ) goto select_end;
|
||||
@ -7289,7 +7289,7 @@ int sqlite3Select(
|
||||
sSort.pOrderBy = 0;
|
||||
}
|
||||
}
|
||||
SELECTTRACE(1,pParse,p,("WhereBegin returns\n"));
|
||||
TREETRACE(0x2,pParse,p,("WhereBegin returns\n"));
|
||||
|
||||
/* If sorting index that was created by a prior OP_OpenEphemeral
|
||||
** instruction ended up not being needed, then change the OP_OpenEphemeral
|
||||
@ -7328,7 +7328,7 @@ int sqlite3Select(
|
||||
|
||||
/* End the database scan loop.
|
||||
*/
|
||||
SELECTTRACE(1,pParse,p,("WhereEnd\n"));
|
||||
TREETRACE(0x2,pParse,p,("WhereEnd\n"));
|
||||
sqlite3WhereEnd(pWInfo);
|
||||
}
|
||||
}else{
|
||||
@ -7451,8 +7451,8 @@ int sqlite3Select(
|
||||
pAggInfo->mxReg = pParse->nMem;
|
||||
if( db->mallocFailed ) goto select_end;
|
||||
#if TREETRACE_ENABLED
|
||||
if( sqlite3TreeTrace & 0x400 ){
|
||||
SELECTTRACE(0x400,pParse,p,("After aggregate analysis %p:\n", pAggInfo));
|
||||
if( sqlite3TreeTrace & 0x20 ){
|
||||
TREETRACE(0x20,pParse,p,("After aggregate analysis %p:\n", pAggInfo));
|
||||
sqlite3TreeViewSelect(0, p, 0);
|
||||
if( minMaxFlag ){
|
||||
sqlite3DebugPrintf("MIN/MAX Optimization (0x%02x) adds:\n", minMaxFlag);
|
||||
@ -7527,7 +7527,7 @@ int sqlite3Select(
|
||||
** in the right order to begin with.
|
||||
*/
|
||||
sqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset);
|
||||
SELECTTRACE(1,pParse,p,("WhereBegin\n"));
|
||||
TREETRACE(0x2,pParse,p,("WhereBegin\n"));
|
||||
pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pGroupBy, pDistinct,
|
||||
p, (sDistinct.isTnct==2 ? WHERE_DISTINCTBY : WHERE_GROUPBY)
|
||||
| (orderByGrp ? WHERE_SORTBYGROUP : 0) | distFlag, 0
|
||||
@ -7537,7 +7537,7 @@ int sqlite3Select(
|
||||
goto select_end;
|
||||
}
|
||||
eDist = sqlite3WhereIsDistinct(pWInfo);
|
||||
SELECTTRACE(1,pParse,p,("WhereBegin returns\n"));
|
||||
TREETRACE(0x2,pParse,p,("WhereBegin returns\n"));
|
||||
if( sqlite3WhereIsOrdered(pWInfo)==pGroupBy->nExpr ){
|
||||
/* The optimizer is able to deliver rows in group by order so
|
||||
** we do not have to sort. The OP_OpenEphemeral table will be
|
||||
@ -7586,7 +7586,7 @@ int sqlite3Select(
|
||||
sqlite3VdbeAddOp2(v, OP_SorterInsert, pAggInfo->sortingIdx, regRecord);
|
||||
sqlite3ReleaseTempReg(pParse, regRecord);
|
||||
sqlite3ReleaseTempRange(pParse, regBase, nCol);
|
||||
SELECTTRACE(1,pParse,p,("WhereEnd\n"));
|
||||
TREETRACE(0x2,pParse,p,("WhereEnd\n"));
|
||||
sqlite3WhereEnd(pWInfo);
|
||||
pAggInfo->sortingIdxPTab = sortPTab = pParse->nTab++;
|
||||
sortOut = sqlite3GetTempReg(pParse);
|
||||
@ -7664,7 +7664,7 @@ int sqlite3Select(
|
||||
sqlite3VdbeAddOp2(v, OP_SorterNext, pAggInfo->sortingIdx,addrTopOfLoop);
|
||||
VdbeCoverage(v);
|
||||
}else{
|
||||
SELECTTRACE(1,pParse,p,("WhereEnd\n"));
|
||||
TREETRACE(0x2,pParse,p,("WhereEnd\n"));
|
||||
sqlite3WhereEnd(pWInfo);
|
||||
sqlite3VdbeChangeToNoop(v, addrSortingIdx);
|
||||
}
|
||||
@ -7826,13 +7826,13 @@ int sqlite3Select(
|
||||
assert( minMaxFlag==WHERE_ORDERBY_NORMAL || pMinMaxOrderBy!=0 );
|
||||
assert( pMinMaxOrderBy==0 || pMinMaxOrderBy->nExpr==1 );
|
||||
|
||||
SELECTTRACE(1,pParse,p,("WhereBegin\n"));
|
||||
TREETRACE(0x2,pParse,p,("WhereBegin\n"));
|
||||
pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pMinMaxOrderBy,
|
||||
pDistinct, p, minMaxFlag|distFlag, 0);
|
||||
if( pWInfo==0 ){
|
||||
goto select_end;
|
||||
}
|
||||
SELECTTRACE(1,pParse,p,("WhereBegin returns\n"));
|
||||
TREETRACE(0x2,pParse,p,("WhereBegin returns\n"));
|
||||
eDist = sqlite3WhereIsDistinct(pWInfo);
|
||||
updateAccumulator(pParse, regAcc, pAggInfo, eDist);
|
||||
if( eDist!=WHERE_DISTINCT_NOOP ){
|
||||
@ -7846,7 +7846,7 @@ int sqlite3Select(
|
||||
if( minMaxFlag ){
|
||||
sqlite3WhereMinMaxOptEarlyOut(v, pWInfo);
|
||||
}
|
||||
SELECTTRACE(1,pParse,p,("WhereEnd\n"));
|
||||
TREETRACE(0x2,pParse,p,("WhereEnd\n"));
|
||||
sqlite3WhereEnd(pWInfo);
|
||||
finalizeAggFunctions(pParse, pAggInfo);
|
||||
}
|
||||
@ -7907,8 +7907,8 @@ select_end:
|
||||
#endif
|
||||
|
||||
#if TREETRACE_ENABLED
|
||||
SELECTTRACE(0x1,pParse,p,("end processing\n"));
|
||||
if( (sqlite3TreeTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
|
||||
TREETRACE(0x1,pParse,p,("end processing\n"));
|
||||
if( (sqlite3TreeTrace & 0x40000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
|
||||
sqlite3TreeViewSelect(0, p, 0);
|
||||
}
|
||||
#endif
|
||||
|
@ -1029,12 +1029,12 @@ extern u32 sqlite3TreeTrace;
|
||||
&& (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_SELECTTRACE) \
|
||||
|| defined(SQLITE_ENABLE_TREETRACE))
|
||||
# define TREETRACE_ENABLED 1
|
||||
# define SELECTTRACE(K,P,S,X) \
|
||||
# define TREETRACE(K,P,S,X) \
|
||||
if(sqlite3TreeTrace&(K)) \
|
||||
sqlite3DebugPrintf("%u/%d/%p: ",(S)->selId,(P)->addrExplain,(S)),\
|
||||
sqlite3DebugPrintf X
|
||||
#else
|
||||
# define SELECTTRACE(K,P,S,X)
|
||||
# define TREETRACE(K,P,S,X)
|
||||
# define TREETRACE_ENABLED 0
|
||||
#endif
|
||||
|
||||
|
@ -1069,7 +1069,7 @@ int sqlite3WindowRewrite(Parse *pParse, Select *p){
|
||||
pSub = sqlite3SelectNew(
|
||||
pParse, pSublist, pSrc, pWhere, pGroupBy, pHaving, pSort, 0, 0
|
||||
);
|
||||
SELECTTRACE(1,pParse,pSub,
|
||||
TREETRACE(0x40,pParse,pSub,
|
||||
("New window-function subquery in FROM clause of (%u/%p)\n",
|
||||
p->selId, p));
|
||||
p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user