diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sqliteInt.h | 4 | ||||
-rw-r--r-- | src/where.c | 22 |
2 files changed, 20 insertions, 6 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 3045d7c4a..d29b2e393 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1151,7 +1151,7 @@ extern u32 sqlite3WhereTrace; ** 0xFFFF---- Low-level debug messages ** ** 0x00000001 Code generation -** 0x00000002 Solver +** 0x00000002 Solver (Use 0x40000 for less detail) ** 0x00000004 Solver costs ** 0x00000008 WhereLoop inserts ** @@ -1170,6 +1170,8 @@ extern u32 sqlite3WhereTrace; ** ** 0x00010000 Show more detail when printing WHERE terms ** 0x00020000 Show WHERE terms returned from whereScanNext() +** 0x00040000 Solver overview messages +** 0x00080000 Star-query heuristic */ diff --git a/src/where.c b/src/where.c index 24674f91d..d25a1723d 100644 --- a/src/where.c +++ b/src/where.c @@ -5544,8 +5544,8 @@ static int computeMxChoice(WhereInfo *pWInfo){ } if( nDep<=3 ) continue; rDelta = 15*(nDep-3); -#ifdef WHERETRACE_ENABLED /* 0x4 */ - if( sqlite3WhereTrace&0x4 ){ +#ifdef WHERETRACE_ENABLED /* 0x80000 */ + if( sqlite3WhereTrace & 0x80000 ){ Bitmask x; int ii; sqlite3DebugPrintf( @@ -5564,10 +5564,12 @@ static int computeMxChoice(WhereInfo *pWInfo){ sqlite3DebugPrintf("\n"); } #endif - for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){ - pWLoop->rStarDelta = 0; + if( pWInfo->nOutStarDelta==0 ){ + for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){ + pWLoop->rStarDelta = 0; + } } - pWInfo->nOutStarDelta = rDelta; + pWInfo->nOutStarDelta += rDelta; for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){ if( pWLoop->maskSelf==m ){ pWLoop->rRun -= rDelta; @@ -5576,6 +5578,16 @@ static int computeMxChoice(WhereInfo *pWInfo){ } } } +#ifdef WHERETRACE_ENABLED /* 0x80000 */ + if( (sqlite3WhereTrace & 0x80000)!=0 && pWInfo->nOutStarDelta ){ + sqlite3DebugPrintf("WhereLoops changed by star-query heuristic:\n"); + for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){ + if( pWLoop->rStarDelta ){ + sqlite3WhereLoopPrint(pWLoop, &pWInfo->sWC); + } + } + } +#endif } return pWInfo->nOutStarDelta>0 ? 18 : 12; } |