aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2010-04-08 15:00:59 +0000
committerdrh <drh@noemail.net>2010-04-08 15:00:59 +0000
commit8bd5412b90c8dcdd052ed9179b8cc4aad4b36d00 (patch)
treeb1be66f08990190a1b3c0cd41faf2428d631a9db /src
parent67ae0cb2313b6ab92fc53f8b307f97ceb62dd1b6 (diff)
downloadsqlite-8bd5412b90c8dcdd052ed9179b8cc4aad4b36d00.tar.gz
sqlite-8bd5412b90c8dcdd052ed9179b8cc4aad4b36d00.zip
Fix the computation of the number of rows in a table during automatic
index generation. FossilOrigin-Name: edeab06a5010c82491a6cc9393cf2a35a7622ac5
Diffstat (limited to 'src')
-rw-r--r--src/where.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/where.c b/src/where.c
index a90f8c740..dbb1f3f39 100644
--- a/src/where.c
+++ b/src/where.c
@@ -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) ){