1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Remove the unexplained extra 3.0 cost factor for the B-tree sorting that is

done to implement DISTINCT in the absence of an index to help.

FossilOrigin-Name: 52571991fcfa2629e8a8354e0c9a62e749a092bf
This commit is contained in:
drh
2016-02-11 21:55:23 +00:00
parent 5d2e2f1267
commit c50d5908b4
3 changed files with 7 additions and 15 deletions

View File

@@ -3460,14 +3460,6 @@ static LogEst whereSortingCost(
assert( nOrderBy>0 && 66==sqlite3LogEst(100) );
rScale = sqlite3LogEst((nOrderBy-nSorted)*100/nOrderBy) - 66;
rSortCost = nRow + estLog(nRow) + rScale + 16;
/* TUNING: The cost of implementing DISTINCT using a B-TREE is
** similar but with a larger constant of proportionality.
** Multiply by an additional factor of 3.0. */
if( pWInfo->wctrlFlags & WHERE_WANT_DISTINCT ){
rSortCost += 16;
}
return rSortCost;
}