mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-16 23:02:26 +03:00
Fix a bug in the multi-index OR cost estimator. Remove leftover "breakpoint"
commands from test scripts. (CVS 6086) FossilOrigin-Name: b090d5736d7eaec17a39d3133e1587b1d2a42acb
This commit is contained in:
@@ -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.354 2008/12/30 16:18:48 drh Exp $
|
||||
** $Id: where.c,v 1.355 2008/12/30 17:55:00 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@@ -1840,7 +1840,6 @@ static void bestIndex(
|
||||
for(i=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
|
||||
WhereClause tempWC;
|
||||
tempWC = *pWC;
|
||||
tempWC.nSlot = 1;
|
||||
if( pTerm->eOperator==WO_OR
|
||||
&& ((pTerm->prereqAll & ~maskSrc) & notReady)==0
|
||||
&& (pTerm->u.pOrInfo->indexable & maskSrc)!=0 ){
|
||||
@@ -1851,11 +1850,13 @@ static void bestIndex(
|
||||
double nRow = 0;
|
||||
for(j=0, pOrTerm=pOrWC->a; j<pOrWC->nTerm; j++, pOrTerm++){
|
||||
WhereCost sTermCost;
|
||||
WHERETRACE(("... Multi-index OR testing for term %d of %d....\n", j,i));
|
||||
if( pOrTerm->eOperator==WO_AND ){
|
||||
WhereClause *pAndWC = &pOrTerm->u.pAndInfo->wc;
|
||||
bestIndex(pParse, pAndWC, pSrc, notReady, 0, &sTermCost);
|
||||
}else if( pOrTerm->leftCursor==iCur ){
|
||||
tempWC.a = pOrTerm;
|
||||
tempWC.nTerm = 1;
|
||||
bestIndex(pParse, &tempWC, pSrc, notReady, 0, &sTermCost);
|
||||
}else{
|
||||
continue;
|
||||
@@ -1867,6 +1868,8 @@ static void bestIndex(
|
||||
rTotal += sTermCost.rCost;
|
||||
nRow += sTermCost.nRow;
|
||||
}
|
||||
WHERETRACE(("... multi-index OR cost=%.9g nrow=%.9g\n",
|
||||
rTotal, nRow));
|
||||
if( rTotal<pCost->rCost ){
|
||||
pCost->rCost = rTotal;
|
||||
pCost->nRow = nRow;
|
||||
|
||||
Reference in New Issue
Block a user