SQLite

Check-in [7d3cb39f60]
Login

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

Overview
Comment:Fix a problem causing non-covered WHERE terms to be evaluated before covered WHERE terms.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | defer-where-subqueries
Files: files | file ages | folders
SHA3-256: 7d3cb39f60951dcec1ff87da2c4ec998f993de5edf49ee5e5f480c6fe4e5a052
User & Date: dan 2017-07-10 14:39:42.059
Context
2017-07-10
15:17
Fix another problem on this branch. (check-in: a4fc98113a user: dan tags: defer-where-subqueries)
14:39
Fix a problem causing non-covered WHERE terms to be evaluated before covered WHERE terms. (check-in: 7d3cb39f60 user: dan tags: defer-where-subqueries)
14:33
When testing non-indexed WHERE constraints, test those that involve correlated sub-queries last of all. This increases the chances of not having to run the sub-query at all. (check-in: 1f9c1f359e user: dan tags: defer-where-subqueries)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/wherecode.c.
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
      }
      pE = pTerm->pExpr;
      assert( pE!=0 );
      if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){
        continue;
      }
      
      if( iNext==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){
        iNext = 2;
        continue;
      }
      if( iLoop<3 && (pE->flags & EP_VarSelect) ){
        if( iNext==0 ) iNext = 3;
        continue;
      }







|







2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
      }
      pE = pTerm->pExpr;
      assert( pE!=0 );
      if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){
        continue;
      }
      
      if( iLoop==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){
        iNext = 2;
        continue;
      }
      if( iLoop<3 && (pE->flags & EP_VarSelect) ){
        if( iNext==0 ) iNext = 3;
        continue;
      }