1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Improved processing of DISTINCT.

FossilOrigin-Name: ba897100fed291d2025f68d09334f9985312298b
This commit is contained in:
drh
2013-06-11 18:59:38 +00:00
parent 8e23daf372
commit 4f402f26b1
5 changed files with 100 additions and 56 deletions

View File

@ -1079,7 +1079,7 @@ static int fuzzerBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
int i;
int seenMatch = 0;
const struct sqlite3_index_constraint *pConstraint;
double rCost = 100000;
double rCost = 1e12;
pConstraint = pIdxInfo->aConstraint;
for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
@ -1095,7 +1095,7 @@ static int fuzzerBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
iPlan |= 1;
pIdxInfo->aConstraintUsage[i].argvIndex = 1;
pIdxInfo->aConstraintUsage[i].omit = 1;
rCost /= 1000000.0;
rCost /= 1e6;
}
if( (iPlan & 2)==0
&& pConstraint->iColumn==1
@ -1132,7 +1132,7 @@ static int fuzzerBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
){
pIdxInfo->orderByConsumed = 1;
}
if( seenMatch && (iPlan&1)==0 ) rCost *= 1e30;
if( seenMatch && (iPlan&1)==0 ) rCost = 1e99;
pIdxInfo->estimatedCost = rCost;
return SQLITE_OK;