Lines Matching refs:pLoop

840   WhereLoop *pLoop;           /* The Loop object */  in constructAutomaticIndex()  local
862 pLoop = pLevel->pWLoop; in constructAutomaticIndex()
890 if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ){ in constructAutomaticIndex()
893 pLoop->aLTerm[nKeyCol++] = pTerm; in constructAutomaticIndex()
899 pLoop->u.btree.nEq = pLoop->nLTerm = nKeyCol; in constructAutomaticIndex()
900 pLoop->wsFlags = WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WHERE_INDEXED in constructAutomaticIndex()
925 pLoop->u.btree.pIndex = pIdx; in constructAutomaticIndex()
950 assert( (u32)n==pLoop->u.btree.nEq ); in constructAutomaticIndex()
998 pLoop->wsFlags |= WHERE_PARTIALIDX; in constructAutomaticIndex()
1006 regBase, pLoop->u.btree.nEq); in constructAutomaticIndex()
1067 WhereLoop *pLoop = pLevel->pWLoop; /* The loop being coded */ in sqlite3ConstructBloomFilter() local
1070 assert( pLoop!=0 ); in sqlite3ConstructBloomFilter()
1072 assert( pLoop->wsFlags & WHERE_BLOOMFILTER ); in sqlite3ConstructBloomFilter()
1114 if( pLoop->wsFlags & WHERE_IPK ){ in sqlite3ConstructBloomFilter()
1120 Index *pIdx = pLoop->u.btree.pIndex; in sqlite3ConstructBloomFilter()
1121 int n = pLoop->u.btree.nEq; in sqlite3ConstructBloomFilter()
1136 pLoop->wsFlags &= ~WHERE_BLOOMFILTER; in sqlite3ConstructBloomFilter()
1143 pLoop = pLevel->pWLoop; in sqlite3ConstructBloomFilter()
1144 if( NEVER(pLoop==0) ) continue; in sqlite3ConstructBloomFilter()
1145 if( pLoop->prereq & notReady ) continue; in sqlite3ConstructBloomFilter()
1146 if( (pLoop->wsFlags & (WHERE_BLOOMFILTER|WHERE_COLUMN_IN)) in sqlite3ConstructBloomFilter()
1693 WhereLoop *pLoop, /* Update the .nOut value of this loop */ in whereRangeSkipScanEst() argument
1696 Index *p = pLoop->u.btree.pIndex; in whereRangeSkipScanEst()
1697 int nEq = pLoop->u.btree.nEq; in whereRangeSkipScanEst()
1743 pLoop->nOut -= nAdjust; in whereRangeSkipScanEst()
1746 nLower, nUpper, nAdjust*-1, pLoop->nOut)); in whereRangeSkipScanEst()
1806 WhereLoop *pLoop /* Modify the .nOut and maybe .rRun fields */ in whereRangeScanEst() argument
1809 int nOut = pLoop->nOut; in whereRangeScanEst()
1813 Index *p = pLoop->u.btree.pIndex; in whereRangeScanEst()
1814 int nEq = pLoop->u.btree.nEq; in whereRangeScanEst()
1822 int nBtm = pLoop->u.btree.nBtm; in whereRangeScanEst()
1823 int nTop = pLoop->u.btree.nTop; in whereRangeScanEst()
1928 rc = whereRangeSkipScanEst(pParse, pLower, pUpper, pLoop, &bDone); in whereRangeScanEst()
1955 if( pLoop->nOut>nOut ){ in whereRangeScanEst()
1957 pLoop->nOut, nOut)); in whereRangeScanEst()
1960 pLoop->nOut = (LogEst)nOut; in whereRangeScanEst()
2623 WhereLoop *pLoop, /* The loop to adjust downward */ in whereLoopOutputAdjust() argument
2627 Bitmask notAllowed = ~(pLoop->prereq|pLoop->maskSelf); in whereLoopOutputAdjust()
2631 assert( (pLoop->wsFlags & WHERE_AUTO_INDEX)==0 ); in whereLoopOutputAdjust()
2635 if( (pTerm->prereqAll & pLoop->maskSelf)==0 ) continue; in whereLoopOutputAdjust()
2637 for(j=pLoop->nLTerm-1; j>=0; j--){ in whereLoopOutputAdjust()
2638 pX = pLoop->aLTerm[j]; in whereLoopOutputAdjust()
2644 if( pLoop->maskSelf==pTerm->prereqAll ){ in whereLoopOutputAdjust()
2655 || (pWC->pWInfo->pTabList->a[pLoop->iTab].fg.jointype in whereLoopOutputAdjust()
2658 pLoop->wsFlags |= WHERE_SELFCULL; in whereLoopOutputAdjust()
2664 pLoop->nOut += pTerm->truthProb; in whereLoopOutputAdjust()
2668 pLoop->nOut--; in whereLoopOutputAdjust()
2688 if( pLoop->nOut > nRow-iReduce ){ in whereLoopOutputAdjust()
2689 pLoop->nOut = nRow - iReduce; in whereLoopOutputAdjust()
4377 WhereLoop *pLoop = 0; /* Current WhereLoop being processed. */ in wherePathSatisfiesOrderBy() local
4425 if( iLoop>0 ) ready |= pLoop->maskSelf; in wherePathSatisfiesOrderBy()
4427 pLoop = pPath->aLoop[iLoop]; in wherePathSatisfiesOrderBy()
4430 pLoop = pLast; in wherePathSatisfiesOrderBy()
4432 if( pLoop->wsFlags & WHERE_VIRTUALTABLE ){ in wherePathSatisfiesOrderBy()
4433 if( pLoop->u.vtab.isOrdered in wherePathSatisfiesOrderBy()
4440 pLoop->u.btree.nDistinctCol = 0; in wherePathSatisfiesOrderBy()
4442 iCur = pWInfo->pTabList->a[pLoop->iTab].iCursor; in wherePathSatisfiesOrderBy()
4464 for(j=0; j<pLoop->nLTerm && pTerm!=pLoop->aLTerm[j]; j++){} in wherePathSatisfiesOrderBy()
4465 if( j>=pLoop->nLTerm ) continue; in wherePathSatisfiesOrderBy()
4480 if( (pLoop->wsFlags & WHERE_ONEROW)==0 ){ in wherePathSatisfiesOrderBy()
4481 if( pLoop->wsFlags & WHERE_IPK ){ in wherePathSatisfiesOrderBy()
4485 }else if( (pIndex = pLoop->u.btree.pIndex)==0 || pIndex->bUnordered ){ in wherePathSatisfiesOrderBy()
4498 && (pLoop->wsFlags & WHERE_SKIPSCAN)==0; in wherePathSatisfiesOrderBy()
4509 assert( j>=pLoop->u.btree.nEq in wherePathSatisfiesOrderBy()
4510 || (pLoop->aLTerm[j]==0)==(j<pLoop->nSkip) in wherePathSatisfiesOrderBy()
4512 if( j<pLoop->u.btree.nEq && j>=pLoop->nSkip ){ in wherePathSatisfiesOrderBy()
4513 u16 eOp = pLoop->aLTerm[j]->eOperator; in wherePathSatisfiesOrderBy()
4540 Expr *pX = pLoop->aLTerm[j]->pExpr; in wherePathSatisfiesOrderBy()
4541 for(i=j+1; i<pLoop->u.btree.nEq; i++){ in wherePathSatisfiesOrderBy()
4542 if( pLoop->aLTerm[i]->pExpr==pX ){ in wherePathSatisfiesOrderBy()
4543 assert( (pLoop->aLTerm[i]->eOperator & WO_IN) ); in wherePathSatisfiesOrderBy()
4568 && j>=pLoop->u.btree.nEq in wherePathSatisfiesOrderBy()
4604 pLoop->u.btree.nDistinctCol = j+1; in wherePathSatisfiesOrderBy()
4625 if( j==pLoop->u.btree.nEq ){ in wherePathSatisfiesOrderBy()
4626 pLoop->wsFlags |= WHERE_BIGNULL_SORT; in wherePathSatisfiesOrderBy()
4654 orderDistinctMask |= pLoop->maskSelf; in wherePathSatisfiesOrderBy()
5183 WhereLoop *pLoop; in whereShortCut() local
5203 pLoop = pBuilder->pNew; in whereShortCut()
5204 pLoop->wsFlags = 0; in whereShortCut()
5205 pLoop->nSkip = 0; in whereShortCut()
5210 pLoop->wsFlags = WHERE_COLUMN_EQ|WHERE_IPK|WHERE_ONEROW; in whereShortCut()
5211 pLoop->aLTerm[0] = pTerm; in whereShortCut()
5212 pLoop->nLTerm = 1; in whereShortCut()
5213 pLoop->u.btree.nEq = 1; in whereShortCut()
5215 pLoop->rRun = 33; /* 33==sqlite3LogEst(10) */ in whereShortCut()
5219 assert( pLoop->aLTermSpace==pLoop->aLTerm ); in whereShortCut()
5222 || pIdx->nKeyCol>ArraySize(pLoop->aLTermSpace) in whereShortCut()
5230 pLoop->aLTerm[j] = pTerm; in whereShortCut()
5233 pLoop->wsFlags = WHERE_COLUMN_EQ|WHERE_ONEROW|WHERE_INDEXED; in whereShortCut()
5235 pLoop->wsFlags |= WHERE_IDX_ONLY; in whereShortCut()
5237 pLoop->nLTerm = j; in whereShortCut()
5238 pLoop->u.btree.nEq = j; in whereShortCut()
5239 pLoop->u.btree.pIndex = pIdx; in whereShortCut()
5241 pLoop->rRun = 39; /* 39==sqlite3LogEst(15) */ in whereShortCut()
5245 if( pLoop->wsFlags ){ in whereShortCut()
5246 pLoop->nOut = (LogEst)1; in whereShortCut()
5247 pWInfo->a[0].pWLoop = pLoop; in whereShortCut()
5249 pLoop->maskSelf = 1; /* sqlite3WhereGetMask(&pWInfo->sMaskSet, iCur); */ in whereShortCut()
5256 if( scan.iEquiv>1 ) pLoop->wsFlags |= WHERE_TRANSCONS; in whereShortCut()
5258 pLoop->cId = '0'; in whereShortCut()
5370 WhereLoop *pLoop; in whereOmitNoopJoin() local
5371 pLoop = pWInfo->a[i].pWLoop; in whereOmitNoopJoin()
5372 pItem = &pWInfo->pTabList->a[pLoop->iTab]; in whereOmitNoopJoin()
5375 && (pLoop->wsFlags & WHERE_ONEROW)==0 in whereOmitNoopJoin()
5379 if( (tabUsed & pLoop->maskSelf)!=0 ) continue; in whereOmitNoopJoin()
5382 if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){ in whereOmitNoopJoin()
5391 WHERETRACE(0xffff, ("-> drop loop %c not used\n", pLoop->cId)); in whereOmitNoopJoin()
5392 notReady &= ~pLoop->maskSelf; in whereOmitNoopJoin()
5394 if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){ in whereOmitNoopJoin()
5436 WhereLoop *pLoop = pWInfo->a[i].pWLoop; in whereCheckIfBloomFilterIsUseful() local
5438 if( (pLoop->wsFlags & reqFlags)==reqFlags in whereCheckIfBloomFilterIsUseful()
5440 && ALWAYS((pLoop->wsFlags & (WHERE_IPK|WHERE_INDEXED))!=0) in whereCheckIfBloomFilterIsUseful()
5442 SrcItem *pItem = &pWInfo->pTabList->a[pLoop->iTab]; in whereCheckIfBloomFilterIsUseful()
5449 pLoop->wsFlags |= WHERE_BLOOMFILTER; in whereCheckIfBloomFilterIsUseful()
5450 pLoop->wsFlags &= ~WHERE_IDX_ONLY; in whereCheckIfBloomFilterIsUseful()
5454 pLoop->cId, (double)sqlite3LogEstToInt(nSearch), pTab->zName, in whereCheckIfBloomFilterIsUseful()
5458 nSearch += pLoop->nOut; in whereCheckIfBloomFilterIsUseful()
5640 WhereLoop *pLoop; /* Pointer to a single WhereLoop object */ in sqlite3WhereBegin() local
5997 pLoop = pLevel->pWLoop; in sqlite3WhereBegin()
6002 if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)!=0 ){ in sqlite3WhereBegin()
6010 if( ((pLoop->wsFlags & WHERE_IDX_ONLY)==0 in sqlite3WhereBegin()
6026 && (pLoop->wsFlags & (WHERE_AUTO_INDEX|WHERE_BLOOMFILTER))==0 in sqlite3WhereBegin()
6038 if( pLoop->u.btree.pIndex!=0 ){ in sqlite3WhereBegin()
6052 if( pLoop->wsFlags & WHERE_INDEXED ){ in sqlite3WhereBegin()
6053 Index *pIx = pLoop->u.btree.pIndex; in sqlite3WhereBegin()
6091 if( (pLoop->wsFlags & WHERE_CONSTRAINT)!=0 in sqlite3WhereBegin()
6092 && (pLoop->wsFlags & (WHERE_COLUMN_RANGE|WHERE_SKIPSCAN))==0 in sqlite3WhereBegin()
6093 && (pLoop->wsFlags & WHERE_BIGNULL_SORT)==0 in sqlite3WhereBegin()
6094 && (pLoop->wsFlags & WHERE_IN_SEEKSCAN)==0 in sqlite3WhereBegin()
6143 pLoop->wsFlags &= ~WHERE_IDX_ONLY; in sqlite3WhereBegin()
6260 WhereLoop *pLoop; in sqlite3WhereEnd() local
6283 pLoop = pLevel->pWLoop; in sqlite3WhereEnd()
6291 && (pLoop->wsFlags & WHERE_INDEXED)!=0 in sqlite3WhereEnd()
6292 && (pIdx = pLoop->u.btree.pIndex)->hasStat1 in sqlite3WhereEnd()
6293 && (n = pLoop->u.btree.nDistinctCol)>0 in sqlite3WhereEnd()
6328 if( (pLoop->wsFlags & WHERE_IN_ABLE)!=0 && pLevel->u.in.nIn>0 ){ in sqlite3WhereEnd()
6339 (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 in sqlite3WhereEnd()
6340 && (pLoop->wsFlags & WHERE_IN_EARLYOUT)!=0; in sqlite3WhereEnd()
6381 VdbeComment((v, "next skip-scan on %s", pLoop->u.btree.pIndex->zName)); in sqlite3WhereEnd()
6393 int ws = pLoop->wsFlags; in sqlite3WhereEnd()
6430 pLoop = pLevel->pWLoop; in sqlite3WhereEnd()
6463 if( pLoop->wsFlags & (WHERE_INDEXED|WHERE_IDX_ONLY) ){ in sqlite3WhereEnd()
6464 pIdx = pLoop->u.btree.pIndex; in sqlite3WhereEnd()
6465 }else if( pLoop->wsFlags & WHERE_MULTI_OR ){ in sqlite3WhereEnd()
6534 assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 in sqlite3WhereEnd()
6539 assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 in sqlite3WhereEnd()