1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-22 20:22:44 +03:00

Fix the computation of the number of rows in a table during automatic

index generation.

FossilOrigin-Name: edeab06a5010c82491a6cc9393cf2a35a7622ac5
This commit is contained in:
drh
2010-04-08 15:00:59 +00:00
parent 67ae0cb231
commit 8bd5412b90
3 changed files with 12 additions and 12 deletions

View File

@@ -1695,7 +1695,8 @@ static void bestAutomaticIndex(
}
assert( pParse->nQueryLoop >= (double)1 );
nTableRow = pSrc->pIndex ? pSrc->pIndex->aiRowEst[0] : 1000000;
pTable = pSrc->pTab;
nTableRow = pTable->pIndex ? pTable->pIndex->aiRowEst[0] : 1000000;
logN = estLog(nTableRow);
costTempIdx = 2*logN*(nTableRow/pParse->nQueryLoop + 1);
if( costTempIdx>=pCost->rCost ){
@@ -1705,7 +1706,6 @@ static void bestAutomaticIndex(
}
/* Search for any equality comparison term */
pTable = pSrc->pTab;
pWCEnd = &pWC->a[pWC->nTerm];
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
if( termCanDriveIndex(pTerm, pSrc, notReady) ){