diff options
author | drh <> | 2025-05-14 16:40:05 +0000 |
---|---|---|
committer | drh <> | 2025-05-14 16:40:05 +0000 |
commit | 691b44a1b3808855c2095d26f721b5ee8aad48a0 (patch) | |
tree | f9933d09e72ff1311cdec932e6d8181a7d0a3341 /src | |
parent | c02ac7b9d7e5ac6a9b60fb80fec1f713c985d42b (diff) | |
download | sqlite-691b44a1b3808855c2095d26f721b5ee8aad48a0.tar.gz sqlite-691b44a1b3808855c2095d26f721b5ee8aad48a0.zip |
Back out the "low-quality index" query planner hack of check-in
[bcac937526d9a6ef]. Subsequent query planner enhancements for dealing
with star-queries make that change unnecessary and the change was recently
found to cause a performance regression in an unrelated query.
Also fix a typo in a debugging message.
FossilOrigin-Name: e7dcf25efae364b7cdf9eb8265803c816c8b8557e4a7684da428badc6ffb3875
Diffstat (limited to 'src')
-rw-r--r-- | src/analyze.c | 10 | ||||
-rw-r--r-- | src/sqliteInt.h | 1 | ||||
-rw-r--r-- | src/where.c | 9 |
3 files changed, 3 insertions, 17 deletions
diff --git a/src/analyze.c b/src/analyze.c index 8ca0e3e74..2721f2523 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -1576,16 +1576,6 @@ static void decodeIntArray( while( z[0]!=0 && z[0]!=' ' ) z++; while( z[0]==' ' ) z++; } - - /* Set the bLowQual flag if the peak number of rows obtained - ** from a full equality match is so large that a full table scan - ** seems likely to be faster than using the index. - */ - if( aLog[0] > 66 /* Index has more than 100 rows */ - && aLog[0] <= aLog[nOut-1] /* And only a single value seen */ - ){ - pIndex->bLowQual = 1; - } } } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index edf925964..af7ed4a4c 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2789,7 +2789,6 @@ struct Index { unsigned isCovering:1; /* True if this is a covering index */ unsigned noSkipScan:1; /* Do not try to use skip-scan if true */ unsigned hasStat1:1; /* aiRowLogEst values come from sqlite_stat1 */ - unsigned bLowQual:1; /* sqlite_stat1 says this is a low-quality index */ unsigned bNoQuery:1; /* Do not use this index to optimize queries */ unsigned bAscKeyBug:1; /* True if the bba7b69f9849b5bf bug applies */ unsigned bIdxRowid:1; /* One or more of the index keys is the ROWID */ diff --git a/src/where.c b/src/where.c index c51d1ba81..0103db5e8 100644 --- a/src/where.c +++ b/src/where.c @@ -3159,11 +3159,8 @@ static int whereLoopAddBtreeIndex( assert( pNew->u.btree.nBtm==0 ); opMask = WO_EQ|WO_IN|WO_GT|WO_GE|WO_LT|WO_LE|WO_ISNULL|WO_IS; } - if( pProbe->bUnordered || pProbe->bLowQual ){ - if( pProbe->bUnordered ) opMask &= ~(WO_GT|WO_GE|WO_LT|WO_LE); - if( pProbe->bLowQual && pSrc->fg.isIndexedBy==0 ){ - opMask &= ~(WO_EQ|WO_IN|WO_IS); - } + if( pProbe->bUnordered ){ + opMask &= ~(WO_GT|WO_GE|WO_LT|WO_LE); } assert( pNew->u.btree.nEq<pProbe->nColumn ); @@ -4100,7 +4097,7 @@ static int whereLoopAddBtree( && (HasRowid(pTab) || pWInfo->pSelect!=0 || sqlite3FaultSim(700)) ){ WHERETRACE(0x200, - ("-> %s a covering index according to bitmasks\n", + ("-> %s is a covering index according to bitmasks\n", pProbe->zName, m==0 ? "is" : "is not")); pNew->wsFlags = WHERE_IDX_ONLY | WHERE_INDEXED; } |