diff options
author | drh <> | 2025-01-24 16:27:18 +0000 |
---|---|---|
committer | drh <> | 2025-01-24 16:27:18 +0000 |
commit | d37412b80c754e4ca1e45d373bb3b3d832662c73 (patch) | |
tree | 7886e8b626ae05707a9985579427282d2ffc6ea8 /src | |
parent | f1c5830311d5d9382a89b87184fb9fb5f5db5420 (diff) | |
download | sqlite-d37412b80c754e4ca1e45d373bb3b3d832662c73.tar.gz sqlite-d37412b80c754e4ca1e45d373bb3b3d832662c73.zip |
The debugging output for WhereLoop objects now shows cost
estimate changes due to the star-query heuristic.
FossilOrigin-Name: a280f5f5480e560fc2b80e8947d8062e8b3487d930e71cb60fc9ba90d87977c1
Diffstat (limited to 'src')
-rw-r--r-- | src/where.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/where.c b/src/where.c index 4fa281c15..14dc99e5c 100644 --- a/src/where.c +++ b/src/where.c @@ -2431,8 +2431,9 @@ void sqlite3WhereClausePrint(WhereClause *pWC){ ** 1.002.001 t2.t2xy 2 f 010241 N 2 cost 0,56,31 */ void sqlite3WhereLoopPrint(const WhereLoop *p, const WhereClause *pWC){ + WhereInfo *pWInfo; if( pWC ){ - WhereInfo *pWInfo = pWC->pWInfo; + pWInfo = pWC->pWInfo; int nb = 1+(pWInfo->pTabList->nSrc+3)/4; SrcItem *pItem = pWInfo->pTabList->a + p->iTab; Table *pTab = pItem->pSTab; @@ -2442,6 +2443,7 @@ void sqlite3WhereLoopPrint(const WhereLoop *p, const WhereClause *pWC){ sqlite3DebugPrintf(" %12s", pItem->zAlias ? pItem->zAlias : pTab->zName); }else{ + pWInfo = 0; sqlite3DebugPrintf("%c%2d.%03llx.%03llx %c%d", p->cId, p->iTab, p->maskSelf, p->prereq & 0xfff, p->cId, p->iTab); } @@ -2473,7 +2475,12 @@ void sqlite3WhereLoopPrint(const WhereLoop *p, const WhereClause *pWC){ }else{ sqlite3DebugPrintf(" f %06x N %d", p->wsFlags, p->nLTerm); } - sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut); + if( pWInfo && pWInfo->nOutStarDelta>0 && p->rStarDelta!=0 ){ + sqlite3DebugPrintf(" cost %d,%d,%d delta=%d\n", + p->rSetup, p->rRun, p->nOut, -p->rStarDelta); + }else{ + sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut); + } if( p->nLTerm && (sqlite3WhereTrace & 0x4000)!=0 ){ int i; for(i=0; i<p->nLTerm; i++){ |