Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | The ".selecttrace 0x2000" command causes just the top-level parse tree to be displayed, after all transformations, and showing the EQP iSelectId at each level. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
ca34c2dd20ee071e6f8d60f91dbf4745 |
User & Date: | drh 2018-04-23 17:43:35.566 |
References
2018-04-24
| ||
00:08 | Fix to check-in [ca34c2dd20ee071e] - avoid a NULL pointer dereference following an OOM. (check-in: c7e6e848fa user: drh tags: trunk) | |
Context
2018-04-23
| ||
18:38 | Add the ".imposter off" variant of the ".imposter" dot-command in the CLI. (check-in: d3dad06ff1 user: drh tags: trunk) | |
17:43 | The ".selecttrace 0x2000" command causes just the top-level parse tree to be displayed, after all transformations, and showing the EQP iSelectId at each level. (check-in: ca34c2dd20 user: drh tags: trunk) | |
17:18 | The ".selecttrace 4" command now shows only a single parse tree after name resolution. (check-in: 5682146e8a user: drh tags: trunk) | |
Changes
Changes to src/select.c.
︙ | ︙ | |||
5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 | sqlite3 *db; /* The database connection */ ExprList *pMinMaxOrderBy = 0; /* Added ORDER BY for min/max queries */ u8 minMaxFlag; /* Flag for min/max queries */ #ifndef SQLITE_OMIT_EXPLAIN int iRestoreSelectId = pParse->iSelectId; pParse->iSelectId = pParse->iNextSelectId++; #endif db = pParse->db; if( p==0 || db->mallocFailed || pParse->nErr ){ return 1; } if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1; | > > > | 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 | sqlite3 *db; /* The database connection */ ExprList *pMinMaxOrderBy = 0; /* Added ORDER BY for min/max queries */ u8 minMaxFlag; /* Flag for min/max queries */ #ifndef SQLITE_OMIT_EXPLAIN int iRestoreSelectId = pParse->iSelectId; pParse->iSelectId = pParse->iNextSelectId++; #if SELECTTRACE_ENABLED p->iSelectId = pParse->iSelectId; #endif #endif db = pParse->db; if( p==0 || db->mallocFailed || pParse->nErr ){ return 1; } if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1; |
︙ | ︙ | |||
5482 5483 5484 5485 5486 5487 5488 | #ifndef SQLITE_OMIT_COMPOUND_SELECT /* Handle compound SELECT statements using the separate multiSelect() ** procedure. */ if( p->pPrior ){ rc = multiSelect(pParse, p, pDest); #if SELECTTRACE_ENABLED | | > > > | 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 | #ifndef SQLITE_OMIT_COMPOUND_SELECT /* Handle compound SELECT statements using the separate multiSelect() ** procedure. */ if( p->pPrior ){ rc = multiSelect(pParse, p, pDest); #if SELECTTRACE_ENABLED SELECTTRACE(0x1,pParse,p,("end compound-select processing\n")); if( pParse->iSelectId==0 && (sqlite3SelectTrace & 0x2000)!=0 ){ sqlite3TreeViewSelect(0, p, 0); } #endif explainSetInteger(pParse->iSelectId, iRestoreSelectId); return rc; } #endif /* For each term in the FROM clause, do two things: |
︙ | ︙ | |||
6273 6274 6275 6276 6277 6278 6279 | ** successful coding of the SELECT. */ select_end: sqlite3ExprListDelete(db, pMinMaxOrderBy); sqlite3DbFree(db, sAggInfo.aCol); sqlite3DbFree(db, sAggInfo.aFunc); #if SELECTTRACE_ENABLED | | > > > | 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 | ** successful coding of the SELECT. */ select_end: sqlite3ExprListDelete(db, pMinMaxOrderBy); sqlite3DbFree(db, sAggInfo.aCol); sqlite3DbFree(db, sAggInfo.aFunc); #if SELECTTRACE_ENABLED SELECTTRACE(0x1,pParse,p,("end processing\n")); if( pParse->iSelectId==0 && (sqlite3SelectTrace & 0x2000)!=0 ){ sqlite3TreeViewSelect(0, p, 0); } #endif explainSetInteger(pParse->iSelectId, iRestoreSelectId); return rc; } |
Changes to src/sqliteInt.h.
︙ | ︙ | |||
2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 | ExprList *pEList; /* The fields of the result */ u8 op; /* One of: TK_UNION TK_ALL TK_INTERSECT TK_EXCEPT */ LogEst nSelectRow; /* Estimated number of result rows */ u32 selFlags; /* Various SF_* values */ int iLimit, iOffset; /* Memory registers holding LIMIT & OFFSET counters */ #if SELECTTRACE_ENABLED char zSelName[12]; /* Symbolic name of this SELECT use for debugging */ #endif int addrOpenEphm[2]; /* OP_OpenEphem opcodes related to this select */ SrcList *pSrc; /* The FROM clause */ Expr *pWhere; /* The WHERE clause */ ExprList *pGroupBy; /* The GROUP BY clause */ Expr *pHaving; /* The HAVING clause */ ExprList *pOrderBy; /* The ORDER BY clause */ | > | 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 | ExprList *pEList; /* The fields of the result */ u8 op; /* One of: TK_UNION TK_ALL TK_INTERSECT TK_EXCEPT */ LogEst nSelectRow; /* Estimated number of result rows */ u32 selFlags; /* Various SF_* values */ int iLimit, iOffset; /* Memory registers holding LIMIT & OFFSET counters */ #if SELECTTRACE_ENABLED char zSelName[12]; /* Symbolic name of this SELECT use for debugging */ u32 iSelectId; /* EXPLAIN QUERY PLAN select ID */ #endif int addrOpenEphm[2]; /* OP_OpenEphem opcodes related to this select */ SrcList *pSrc; /* The FROM clause */ Expr *pWhere; /* The WHERE clause */ ExprList *pGroupBy; /* The GROUP BY clause */ Expr *pHaving; /* The HAVING clause */ ExprList *pOrderBy; /* The ORDER BY clause */ |
︙ | ︙ |
Changes to src/treeview.c.
︙ | ︙ | |||
135 136 137 138 139 140 141 | sqlite3TreeViewWith(pView, p->pWith, 1); cnt = 1; sqlite3TreeViewPush(pView, 1); } do{ #if SELECTTRACE_ENABLED sqlite3TreeViewLine(pView, | | | | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | sqlite3TreeViewWith(pView, p->pWith, 1); cnt = 1; sqlite3TreeViewPush(pView, 1); } do{ #if SELECTTRACE_ENABLED sqlite3TreeViewLine(pView, "SELECT%s%s (%s/%d/%p) selFlags=0x%x nSelectRow=%d", ((p->selFlags & SF_Distinct) ? " DISTINCT" : ""), ((p->selFlags & SF_Aggregate) ? " agg_flag" : ""), p->zSelName, p->iSelectId, p, p->selFlags, (int)p->nSelectRow ); #else sqlite3TreeViewLine(pView, "SELECT%s%s (0x%p) selFlags=0x%x nSelectRow=%d", ((p->selFlags & SF_Distinct) ? " DISTINCT" : ""), ((p->selFlags & SF_Aggregate) ? " agg_flag" : ""), p, p->selFlags, (int)p->nSelectRow |
︙ | ︙ |