1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Extra steps taken to avoid using low-quality indexes in a query plan.

This branch accomplishes the same end as the nearby enhanced-stat1 branch,
but with much less change and hence less risk.

FossilOrigin-Name: c030e646262fee43a59b45fdc1630d972f8bf88ac3c142b6bdaf4cbb36695a4f
This commit is contained in:
drh
2024-01-01 17:48:02 +00:00
parent 307f326ba3
commit 4ccf707c6e
5 changed files with 28 additions and 11 deletions

View File

@@ -1556,6 +1556,16 @@ 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;
}
}
}