/ Check-in [9d05777f]
Login

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

Overview
Comment:Try to factor constant subcomponents of the WHERE clause out of the loop.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9d05777fe24e1a5ce71762de38db840931ef0bc8
User & Date: drh 2014-01-02 21:05:10
Context
2014-01-03
16:03
Avoid some unnecessary OP_SCopy operations when inserting into a table with multiple indices. check-in: 429018b1 user: drh tags: trunk
2014-01-02
21:05
Try to factor constant subcomponents of the WHERE clause out of the loop. check-in: 9d05777f user: drh tags: trunk
19:35
Avoid unnecessary affinity transformations when building indices using data from a table. check-in: 10d85135 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

  5426   5426     whereClauseInit(&pWInfo->sWC, pWInfo);
  5427   5427     whereSplit(&pWInfo->sWC, pWhere, TK_AND);
  5428   5428     sqlite3CodeVerifySchema(pParse, -1); /* Insert the cookie verifier Goto */
  5429   5429       
  5430   5430     /* Special case: a WHERE clause that is constant.  Evaluate the
  5431   5431     ** expression and either jump over all of the code or fall thru.
  5432   5432     */
  5433         -  if( pWhere && (nTabList==0 || sqlite3ExprIsConstantNotJoin(pWhere)) ){
  5434         -    sqlite3ExprIfFalse(pParse, pWhere, pWInfo->iBreak, SQLITE_JUMPIFNULL);
  5435         -    pWhere = 0;
         5433  +  for(ii=0; ii<sWLB.pWC->nTerm; ii++){
         5434  +    if( nTabList==0 || sqlite3ExprIsConstantNotJoin(sWLB.pWC->a[ii].pExpr) ){
         5435  +      sqlite3ExprIfFalse(pParse, sWLB.pWC->a[ii].pExpr, pWInfo->iBreak,
         5436  +                         SQLITE_JUMPIFNULL);
         5437  +      sWLB.pWC->a[ii].wtFlags |= TERM_CODED;
         5438  +    }
  5436   5439     }
  5437   5440   
  5438   5441     /* Special case: No FROM clause
  5439   5442     */
  5440   5443     if( nTabList==0 ){
  5441   5444       if( pOrderBy ) pWInfo->bOBSat = 1;
  5442   5445       if( wctrlFlags & WHERE_WANT_DISTINCT ){