aboutsummaryrefslogtreecommitdiff
path: root/src/select.c
diff options
context:
space:
mode:
authordan <Dan Kennedy>2022-12-02 20:32:22 +0000
committerdan <Dan Kennedy>2022-12-02 20:32:22 +0000
commit231ff4b027b077ce9ac0c829cd9cee4108ca9b7a (patch)
tree5cf6210ffda1cc351169cef8dc576ac2edc83fc9 /src/select.c
parentbb4e4a4840530da37c6fdaabc9769a1996f25809 (diff)
downloadsqlite-231ff4b027b077ce9ac0c829cd9cee4108ca9b7a.tar.gz
sqlite-231ff4b027b077ce9ac0c829cd9cee4108ca9b7a.zip
Enhance the sqlite3_stmt_scanstatus() API and add sqlite3_stmt_scanstatus_v2(). For creation of easier to read query performance reports.
FossilOrigin-Name: 55800833645739efeddcacef464c623931cb6aeb43f4219b4e4faf473c25c8bb
Diffstat (limited to 'src/select.c')
-rw-r--r--src/select.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/select.c b/src/select.c
index 0cd28b543..740372525 100644
--- a/src/select.c
+++ b/src/select.c
@@ -7277,6 +7277,9 @@ int sqlite3Select(
** the same view can reuse the materialization. */
int topAddr;
int onceAddr = 0;
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
+ int addrExplain;
+#endif
pItem->regReturn = ++pParse->nMem;
topAddr = sqlite3VdbeAddOp0(v, OP_Goto);
@@ -7292,7 +7295,8 @@ int sqlite3Select(
VdbeNoopComment((v, "materialize %!S", pItem));
}
sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor);
- ExplainQueryPlan((pParse, 1, "MATERIALIZE %!S", pItem));
+
+ ExplainQueryPlan2(addrExplain, (pParse, 1, "MATERIALIZE %!S", pItem));
dest.zAffSdst = sqlite3TableAffinityStr(db, pItem->pTab);
sqlite3Select(pParse, pSub, &dest);
sqlite3DbFree(db, dest.zAffSdst);
@@ -7301,6 +7305,7 @@ int sqlite3Select(
if( onceAddr ) sqlite3VdbeJumpHere(v, onceAddr);
sqlite3VdbeAddOp2(v, OP_Return, pItem->regReturn, topAddr+1);
VdbeComment((v, "end %!S", pItem));
+ sqlite3VdbeScanStatusEnd(v, addrExplain);
sqlite3VdbeJumpHere(v, topAddr);
sqlite3ClearTempRegCache(pParse);
if( pItem->fg.isCte && pItem->fg.isCorrelated==0 ){