/ Check-in [7d3cb39f]
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 | SQL 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
Context
2017-07-10
15:17
Fix another problem on this branch. check-in: a4fc9811 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: 7d3cb39f 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: 1f9c1f35 user: dan tags: defer-where-subqueries
Changes
Hide Diffs Unified Diffs 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;
      }