mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Improvments to debug output on the star-query heuristic.
FossilOrigin-Name: b3ebeb0682a2c837987acf4ed92f06cf91aea235830c5a0f9dd1ce64afe16e84
This commit is contained in:
@ -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
|
||||
*/
|
||||
|
||||
|
||||
|
22
src/where.c
22
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user