mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-16 23:02:26 +03:00
Add a small cost penalty to sorting to bias the query planner in favor of
plans that do not require a final sorting pass. FossilOrigin-Name: 85b9beb4605eb0cfe2ed063c2a1925186c9e37031f78c875e60a347cce891638
This commit is contained in:
@@ -4056,7 +4056,11 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
|
||||
pWInfo, nRowEst, nOrderBy, isOrdered
|
||||
);
|
||||
}
|
||||
rCost = sqlite3LogEstAdd(rUnsorted, aSortCost[isOrdered]);
|
||||
/* TUNING: Add a small extra penalty (5) to sorting as an
|
||||
** extra encouragment to the query planner to select a plan
|
||||
** where the rows emerge in the correct order without any sorting
|
||||
** required. */
|
||||
rCost = sqlite3LogEstAdd(rUnsorted, aSortCost[isOrdered]) + 5;
|
||||
|
||||
WHERETRACE(0x002,
|
||||
("---- sort cost=%-3d (%d/%d) increases cost %3d to %-3d\n",
|
||||
|
||||
Reference in New Issue
Block a user