aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2013-06-10 14:56:25 +0000
committerdrh <drh@noemail.net>2013-06-10 14:56:25 +0000
commit3b75ffaacab82d95b469ce2099df7b60b3b4a718 (patch)
tree04ff011c69f359f6144b18456f19b1eaa9eb5516 /src
parent43b85ef5c6c76ba34acbcb10fdd64bf53582695c (diff)
downloadsqlite-3b75ffaacab82d95b469ce2099df7b60b3b4a718.tar.gz
sqlite-3b75ffaacab82d95b469ce2099df7b60b3b4a718.zip
Simplification and performance tweak to the high-speed NGQP bypass.
FossilOrigin-Name: 0f8a38ee54208d6a477aa2482cd277b4808450f0
Diffstat (limited to 'src')
-rw-r--r--src/where.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/where.c b/src/where.c
index 37d1b151c..8f25d1d96 100644
--- a/src/where.c
+++ b/src/where.c
@@ -5192,7 +5192,6 @@ static int whereSimpleFastCase(WhereLoopBuilder *pBuilder){
WhereLoop *pLoop;
int iCur;
int j;
- int nOrderBy;
Table *pTab;
Index *pIdx;
@@ -5205,29 +5204,19 @@ static int whereSimpleFastCase(WhereLoopBuilder *pBuilder){
iCur = pItem->iCursor;
pWC = &pWInfo->sWC;
pLoop = pBuilder->pNew;
- pWInfo->a[0].pWLoop = pLoop;
pLoop->wsFlags = 0;
- pLoop->maskSelf = getMask(&pWInfo->sMaskSet, iCur);
- pWInfo->a[0].iTabCur = iCur;
-#ifdef SQLITE_DEBUG
- pLoop->cId = '0';
-#endif
- nOrderBy = pWInfo->pOrderBy ? pWInfo->pOrderBy->nExpr : 0;
- pTerm = findTerm(pWC, iCur, -1, 1, WO_EQ, 0);
+ pTerm = findTerm(pWC, iCur, -1, 0, WO_EQ, 0);
if( pTerm ){
pLoop->wsFlags = WHERE_COLUMN_EQ|WHERE_IPK|WHERE_ONEROW;
pLoop->aLTerm[0] = pTerm;
pLoop->nLTerm = 1;
pLoop->u.btree.nEq = 1;
pLoop->rRun = (WhereCost)10;
- pLoop->nOut = (WhereCost)1;
- pWInfo->nRowOut = 1;
- pWInfo->nOBSat = nOrderBy;
}else{
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
if( pIdx->onError==OE_None ) continue;
for(j=0; j<pIdx->nColumn; j++){
- pTerm = findTerm(pWC, iCur, pIdx->aiColumn[j], 1, WO_EQ, pIdx);
+ pTerm = findTerm(pWC, iCur, pIdx->aiColumn[j], 0, WO_EQ, pIdx);
if( pTerm==0 ) break;
whereLoopResize(pWInfo->pParse->db, pLoop, j);
pLoop->aLTerm[j] = pTerm;
@@ -5241,13 +5230,22 @@ static int whereSimpleFastCase(WhereLoopBuilder *pBuilder){
pLoop->u.btree.nEq = j;
pLoop->u.btree.pIndex = pIdx;
pLoop->rRun = (WhereCost)15;
- pLoop->nOut = (WhereCost)1;
- pWInfo->nRowOut = 1;
- pWInfo->nOBSat = nOrderBy;
break;
}
}
- return pLoop->wsFlags!=0;
+ if( pLoop->wsFlags ){
+ pLoop->nOut = (WhereCost)1;
+ pWInfo->a[0].pWLoop = pLoop;
+ pLoop->maskSelf = getMask(&pWInfo->sMaskSet, iCur);
+ pWInfo->a[0].iTabCur = iCur;
+ pWInfo->nRowOut = 1;
+ pWInfo->nOBSat = pWInfo->pOrderBy ? pWInfo->pOrderBy->nExpr : 0;
+#ifdef SQLITE_DEBUG
+ pLoop->cId = '0';
+#endif
+ return 1;
+ }
+ return 0;
}
/*