/ Check-in [ea2e5b34]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improvements to ".wheretrace" output.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ea2e5b34bf35ade602dfcef359b64f810674f304fda14326b7f2dedefcc5f340
User & Date: drh 2018-04-09 13:58:20
Context
2018-04-09
14:26
Fix the fts5 xBestIndex method so that it is not confused by "IS", "!=", "REGEXP", "GLOB" or "LIKE" operators. Fix for ticket [2b8aed9f]. check-in: a0ca4ddb user: dan tags: trunk
13:58
Improvements to ".wheretrace" output. check-in: ea2e5b34 user: drh tags: trunk
11:43
Add a "flags" parameter to experimental API sqlite3changeset_apply_v2(). Also add the SQLITE_CHANGESETAPPLY_NOSAVEPOINT flag. check-in: 3d29631f user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

  2369   2369     int rc = SQLITE_OK;             /* Return code */
  2370   2370     LogEst rSize;                   /* Number of rows in the table */
  2371   2371     LogEst rLogSize;                /* Logarithm of table size */
  2372   2372     WhereTerm *pTop = 0, *pBtm = 0; /* Top and bottom range constraints */
  2373   2373   
  2374   2374     pNew = pBuilder->pNew;
  2375   2375     if( db->mallocFailed ) return SQLITE_NOMEM_BKPT;
  2376         -  WHERETRACE(0x800, ("BEGIN addBtreeIdx(%s), nEq=%d\n",
  2377         -                     pProbe->zName, pNew->u.btree.nEq));
         2376  +  WHERETRACE(0x800, ("BEGIN %s.addBtreeIdx(%s), nEq=%d\n",
         2377  +                     pProbe->pTable->zName,pProbe->zName, pNew->u.btree.nEq));
  2378   2378   
  2379   2379     assert( (pNew->wsFlags & WHERE_VIRTUALTABLE)==0 );
  2380   2380     assert( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 );
  2381   2381     if( pNew->wsFlags & WHERE_BTM_LIMIT ){
  2382   2382       opMask = WO_LT|WO_LE;
  2383   2383     }else{
  2384   2384       assert( pNew->u.btree.nBtm==0 );
................................................................................
  2656   2656       whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter + nInMul);
  2657   2657       pNew->nOut = saved_nOut;
  2658   2658       pNew->u.btree.nEq = saved_nEq;
  2659   2659       pNew->nSkip = saved_nSkip;
  2660   2660       pNew->wsFlags = saved_wsFlags;
  2661   2661     }
  2662   2662   
  2663         -  WHERETRACE(0x800, ("END addBtreeIdx(%s), nEq=%d, rc=%d\n",
  2664         -                      pProbe->zName, saved_nEq, rc));
         2663  +  WHERETRACE(0x800, ("END %s.addBtreeIdx(%s), nEq=%d, rc=%d\n",
         2664  +                      pProbe->pTable->zName, pProbe->zName, saved_nEq, rc));
  2665   2665     return rc;
  2666   2666   }
  2667   2667   
  2668   2668   /*
  2669   2669   ** Return True if it is possible that pIndex might be useful in
  2670   2670   ** implementing the ORDER BY clause in pBuilder.
  2671   2671   **
................................................................................
  3240   3240     nConstraint = p->nConstraint;
  3241   3241     if( whereLoopResize(pParse->db, pNew, nConstraint) ){
  3242   3242       sqlite3DbFree(pParse->db, p);
  3243   3243       return SQLITE_NOMEM_BKPT;
  3244   3244     }
  3245   3245   
  3246   3246     /* First call xBestIndex() with all constraints usable. */
         3247  +  WHERETRACE(0x800, ("BEGIN %s.addVirtual()\n", pSrc->pTab->zName));
  3247   3248     WHERETRACE(0x40, ("  VirtualOne: all usable\n"));
  3248   3249     rc = whereLoopAddVirtualOne(pBuilder, mPrereq, ALLBITS, 0, p, mNoOmit, &bIn);
  3249   3250   
  3250   3251     /* If the call to xBestIndex() with all terms enabled produced a plan
  3251   3252     ** that does not require any source tables (IOW: a plan with mBest==0),
  3252   3253     ** then there is no point in making any further calls to xBestIndex() 
  3253   3254     ** since they will all return the same result (if the xBestIndex()
................................................................................
  3315   3316         rc = whereLoopAddVirtualOne(
  3316   3317             pBuilder, mPrereq, mPrereq, WO_IN, p, mNoOmit, &bIn);
  3317   3318       }
  3318   3319     }
  3319   3320   
  3320   3321     if( p->needToFreeIdxStr ) sqlite3_free(p->idxStr);
  3321   3322     sqlite3DbFreeNN(pParse->db, p);
         3323  +  WHERETRACE(0x800, ("END %s.addVirtual(), rc=%d\n", pSrc->pTab->zName, rc));
  3322   3324     return rc;
  3323   3325   }
  3324   3326   #endif /* SQLITE_OMIT_VIRTUALTABLE */
  3325   3327   
  3326   3328   /*
  3327   3329   ** Add WhereLoop entries to handle OR terms.  This works for either
  3328   3330   ** btrees or virtual tables.