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

Prevent the WhereLoop.rSetup cost estimate from going negative on complex

queries.

FossilOrigin-Name: f81050859170c8708a1b296da8dd3ef0dd314a11
This commit is contained in:
drh
2016-06-26 04:06:28 +00:00
parent 4b37cd49a6
commit 05d1bad674
3 changed files with 8 additions and 7 deletions

View File

@@ -2701,6 +2701,7 @@ static int whereLoopAddBtree(
pNew->rSetup += 24;
}
ApplyCostMultiplier(pNew->rSetup, pTab->costMult);
if( pNew->rSetup<0 ) pNew->rSetup = 0;
/* TUNING: Each index lookup yields 20 rows in the table. This
** is more than the usual guess of 10 rows, since we have no way
** of knowing how selective the index will ultimately be. It would