diff options
author | drh <drh@noemail.net> | 2007-09-13 17:54:40 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2007-09-13 17:54:40 +0000 |
commit | 8e70e34a28a00b6e55268632b178c087b3874bea (patch) | |
tree | 0b244f26cc3ee5737964c2624dd7eb2eeb06f340 /src | |
parent | 4152e677b868bb8e08ecea5da02a522676de0df3 (diff) | |
download | sqlite-8e70e34a28a00b6e55268632b178c087b3874bea.tar.gz sqlite-8e70e34a28a00b6e55268632b178c087b3874bea.zip |
Fix incorrect index cost assumptions that occur after an ANALYZE.
Ticket #2643. (CVS 4424)
FossilOrigin-Name: 2cfdbfe6543bac42961deecec7d085d806e604b5
Diffstat (limited to 'src')
-rw-r--r-- | src/where.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/where.c b/src/where.c index 126b0847c..0deea1413 100644 --- a/src/where.c +++ b/src/where.c @@ -16,7 +16,7 @@ ** so is applicable. Because this module is responsible for selecting ** indices, you might also think of this module as the "query optimizer". ** -** $Id: where.c,v 1.260 2007/09/12 15:41:01 drh Exp $ +** $Id: where.c,v 1.261 2007/09/13 17:54:40 drh Exp $ */ #include "sqliteInt.h" @@ -1565,7 +1565,7 @@ static double bestIndex( && nEq==pProbe->nColumn ){ flags |= WHERE_UNIQUE; } - WHERETRACE(("...... nEq=%d inMult=%.9g cost=%.9g\n", nEq, inMultiplier, cost)); + WHERETRACE(("...... nEq=%d inMult=%.9g cost=%.9g\n",nEq,inMultiplier,cost)); /* Look for range constraints */ @@ -1626,10 +1626,9 @@ static double bestIndex( /* If this index has achieved the lowest cost so far, then use it. */ - if( cost < lowestCost ){ + if( flags && cost < lowestCost ){ bestIdx = pProbe; lowestCost = cost; - assert( flags!=0 ); bestFlags = flags; bestNEq = nEq; } |