Lines Matching full:plan
3495 ** WHERE clause might influence the choice of query plan for a statement,
3500 ** choice of query plan if the parameter is the left-hand side of a [LIKE]
10817 WherePlan plan; /* query plan for this element of the FROM clause */
10828 union { /* Information that depends on plan.wsFlags */
10835 } in; /* Used when plan.wsFlags&WHERE_IN_ABLE */
42526 ** SQLITE_OK is returned if everything goes according to plan. An
60650 ** EXPLAIN QUERY PLAN.
62748 ** in a better query plan.
63771 ** binding a new value to this variable invalidates the current query plan.
63774 ** parameter in the WHERE clause might influence the choice of query plan
70721 ** by P1. The integer query plan parameter to xFilter is stored in register
71072 ** is to say when the EXPLAIN QUERY PLAN syntax is used.)
82505 ** This plan is not completely bullet-proof. It is possible for
95315 ** Unless an "EXPLAIN QUERY PLAN" command is being processed, this function
95349 ** Unless an "EXPLAIN QUERY PLAN" command is being processed, this function
96640 ** The implementation plan is to implement the two coroutines and seven
101974 /* If everything went according to plan, link the new VTable structure
102752 WherePlan plan; /* The lookup strategy */
102754 Bitmask used; /* Bitmask of cursors used by this plan */
104355 WhereCost *pCost /* Lowest cost query plan */
104408 nRow += sTermCost.plan.nRow;
104428 pCost->plan.nRow = nRow;
104429 pCost->plan.wsFlags = flags;
104430 pCost->plan.u.pTerm = pTerm;
104460 ** If the query plan for pSrc specified in pCost is a full table scan
104464 ** is taken into account, then alter the query plan to use the
104472 WhereCost *pCost /* Lowest cost query plan */
104489 if( (pCost->plan.wsFlags & WHERE_NOT_FULLSCAN)!=0 ){
104520 pCost->plan.nRow = logN + 1;
104521 pCost->plan.wsFlags = WHERE_TEMP_INDEX;
104588 pLevel->plan.nEq = nColumn;
104608 pLevel->plan.wsFlags |= WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WO_EQ;
104617 pLevel->plan.u.pIdx = pIdx;
104640 assert( (u32)n==pLevel->plan.nEq );
104829 "table %s: xBestIndex returned an invalid plan", pTab->zName);
104860 WhereCost *pCost, /* Lowest cost query plan */
104877 pCost->plan.wsFlags = WHERE_VIRTUALTABLE;
104978 pCost->plan.u.pVtabIdx = pIdxInfo;
104980 pCost->plan.wsFlags |= WHERE_ORDERBY;
104982 pCost->plan.nEq = 0;
105389 ** Find the best query plan for accessing a particular table. Write the
105390 ** best query plan and its cost into the WhereCost object supplied as the
105393 ** The lowest cost plan wins. The cost is an estimate of the amount of
105407 ** named index. If no such plan is found, then the returned cost is
105408 ** SQLITE_BIG_DBL. If a plan is found that uses the named index,
105413 ** selected plan may still take advantage of the built-in rowid primary key
105424 WhereCost *pCost /* Lowest cost query plan */
105434 int wsFlagMask; /* Allowed flags in pCost->plan.wsFlag */
105850 && (cost<pCost->rCost || (cost<=pCost->rCost && nRow<pCost->plan.nRow))
105854 pCost->plan.nRow = nRow;
105855 pCost->plan.wsFlags = (wsFlags&wsFlagMask);
105856 pCost->plan.nEq = nEq;
105857 pCost->plan.u.pIdx = pIdx;
105875 pCost->plan.wsFlags |= WHERE_REVERSE;
105878 assert( pOrderBy || (pCost->plan.wsFlags&WHERE_ORDERBY)==0 );
105879 assert( pCost->plan.u.pIdx==0 || (pCost->plan.wsFlags&WHERE_ROWID_EQ)==0 );
105881 || pCost->plan.u.pIdx==0
105882 || pCost->plan.u.pIdx==pSrc->pIndex
105886 ((pCost->plan.wsFlags & WHERE_NOT_FULLSCAN)==0 ? "none" :
105887 pCost->plan.u.pIdx ? pCost->plan.u.pIdx->zName : "ipk")
105892 pCost->plan.wsFlags |= eqTermMask;
105896 ** Find the query plan for accessing table pSrc->pTab. Write the
105897 ** best query plan and its cost into the WhereCost object supplied
105908 WhereCost *pCost /* Lowest cost query plan */
106044 assert( pLevel->plan.wsFlags & WHERE_IN_ABLE );
106118 int nEq = pLevel->plan.nEq; /* The number of == or IN constraints to code */
106129 assert( pLevel->plan.wsFlags & WHERE_INDEXED );
106130 pIdx = pLevel->plan.u.pIdx;
106135 nReg = pLevel->plan.nEq + nExtraReg;
106149 pTerm = findTerm(pWC, iCur, k, notReady, pLevel->plan.wsFlags, pIdx);
106224 WherePlan *pPlan = &pLevel->plan;
106256 ** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN
106257 ** command. If the query being compiled is an EXPLAIN QUERY PLAN, a single
106270 u32 flags = pLevel->plan.wsFlags;
106281 isSearch = (pLevel->plan.nEq>0)
106301 ((flags & WHERE_TEMP_INDEX)?"": pLevel->plan.u.pIdx->zName),
106320 sqlite3_index_info *pVtabIdx = pLevel->plan.u.pVtabIdx;
106329 nRow = (sqlite3_int64)pLevel->plan.nRow;
106372 bRev = (pLevel->plan.wsFlags & WHERE_REVERSE)!=0;
106373 omitTable = (pLevel->plan.wsFlags & WHERE_IDX_ONLY)!=0
106400 if( (pLevel->plan.wsFlags & WHERE_VIRTUALTABLE)!=0 ){
106405 sqlite3_index_info *pVtabIdx = pLevel->plan.u.pVtabIdx;
106443 if( pLevel->plan.wsFlags & WHERE_ROWID_EQ ){
106463 }else if( pLevel->plan.wsFlags & WHERE_ROWID_RANGE ){
106540 }else if( pLevel->plan.wsFlags & (WHERE_COLUMN_RANGE|WHERE_COLUMN_EQ) ){
106587 int nEq = pLevel->plan.nEq; /* Number of == or IN terms */
106604 pIdx = pLevel->plan.u.pIdx;
106617 && (pLevel->plan.wsFlags&WHERE_ORDERBY)
106629 if( pLevel->plan.wsFlags & WHERE_TOP_LIMIT ){
106633 if( pLevel->plan.wsFlags & WHERE_BTM_LIMIT ){
106751 testcase( pLevel->plan.wsFlags & WHERE_BTM_LIMIT );
106752 testcase( pLevel->plan.wsFlags & WHERE_TOP_LIMIT );
106753 if( (pLevel->plan.wsFlags & (WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0 ){
106772 if( pLevel->plan.wsFlags & WHERE_UNIQUE ){
106783 if( pLevel->plan.wsFlags & WHERE_MULTI_OR ){
106835 pTerm = pLevel->plan.u.pTerm;
107030 ** The following variable holds a text description of query plan generated
107056 if( pWInfo->a[i].plan.wsFlags & WHERE_TEMP_INDEX ){
107057 Index *pIdx = pWInfo->a[i].plan.u.pIdx;
107323 WhereCost bestPlan; /* Most efficient plan seen so far */
107349 ** its query plan, then checking to see if that query plan uses any
107351 ** used then the "optimal" query plan works.
107365 ** cost. However, this meant that SQLite could select the wrong plan
107417 /* If an INDEXED BY clause is present, then the plan must use that
107420 || (sCost.plan.wsFlags & WHERE_NOT_FULLSCAN)==0
107421 || sCost.plan.u.pIdx==pTabItem->pIndex );
107423 if( isOptimal && (sCost.plan.wsFlags & WHERE_NOT_FULLSCAN)==0 ){
107432 ** (2) A full-table-scan plan cannot supercede indexed plan unless
107433 ** the full-table-scan is an "optimal" plan as defined above.
107444 ** (4) The plan cost must be lower than prior plans or else the
107449 || (bestPlan.plan.wsFlags & WHERE_NOT_FULLSCAN)==0
107450 || (sCost.plan.wsFlags & WHERE_NOT_FULLSCAN)!=0)
107452 || NEVER((sCost.plan.wsFlags & WHERE_NOT_FULLSCAN)!=0))
107455 && sCost.plan.nRow<bestPlan.plan.nRow))
107459 j, sCost.rCost, sCost.plan.nRow));
107470 bestJ, pLevel-pWInfo->a, bestPlan.rCost, bestPlan.plan.nRow));
107472 if( (bestPlan.plan.wsFlags & WHERE_ORDERBY)!=0 && ALWAYS(ppOrderBy) ){
107475 if( (bestPlan.plan.wsFlags & WHERE_DISTINCT)!=0 ){
107479 andFlags &= bestPlan.plan.wsFlags;
107480 pLevel->plan = bestPlan.plan;
107481 testcase( bestPlan.plan.wsFlags & WHERE_INDEXED );
107482 testcase( bestPlan.plan.wsFlags & WHERE_TEMP_INDEX );
107483 if( bestPlan.plan.wsFlags & (WHERE_INDEXED|WHERE_TEMP_INDEX) ){
107490 if( bestPlan.plan.nRow>=(double)1 ){
107491 pParse->nQueryLoop *= bestPlan.plan.nRow;
107501 if( (bestPlan.plan.wsFlags & WHERE_INDEXED)==0 ){
107508 assert( bestPlan.plan.u.pIdx==pIdx );
107532 pWInfo->a[0].plan.wsFlags &= ~WHERE_IDX_ONLY;
107548 pWInfo->nRowOut *= pLevel->plan.nRow;
107554 if( (pLevel->plan.wsFlags & WHERE_VIRTUALTABLE)!=0 ){
107560 if( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0
107578 if( (pLevel->plan.wsFlags & WHERE_TEMP_INDEX)!=0 ){
107582 if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 ){
107583 Index *pIx = pLevel->plan.u.pIdx;
107611 /* Record in the query plan information about the current table
107626 if( pLevel->plan.wsFlags & WHERE_IDX_ONLY ){
107635 testcase( pLevel->plan.wsFlags & WHERE_ROWID_EQ );
107636 testcase( pLevel->plan.wsFlags & WHERE_ROWID_RANGE );
107637 if( pLevel->plan.wsFlags & (WHERE_ROWID_EQ|WHERE_ROWID_RANGE) ){
107640 }else if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 ){
107641 n = sqlite3Strlen30(pLevel->plan.u.pIdx->zName);
107643 memcpy(&sqlite3_query_plan[nQPlan], pLevel->plan.u.pIdx->zName, n);
107695 if( pLevel->plan.wsFlags & WHERE_IN_ABLE && pLevel->u.in.nIn>0 ){
107710 assert( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0
107711 || (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 );
107712 if( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0 ){
107743 int ws = pLevel->plan.wsFlags;
107765 if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 && !db->mallocFailed){
107768 Index *pIdx = pLevel->plan.u.pIdx;
107783 assert( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0
108580 26, /* PLAN => ID */
108722 "PLAN", "BEGIN", "TRANSACTION", "DEFERRED",
108798 /* 7 */ "explain ::= EXPLAIN QUERY PLAN",
109897 case 7: /* explain ::= EXPLAIN QUERY PLAN */
111552 testcase( i==73 ); /* PLAN */