SQLite

Check-in [548082dfab]
Login

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

Overview
Comment:Improvements to the LEFT JOIN strength reduction optimization.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 548082dfab5d9484279ccc11cd2833ac131b54b7481372b576d7c28bbb3294ea
User & Date: drh 2019-10-11 16:01:21.642
Context
2019-10-11
17:14
Futher improvements to LEFT JOIN strength reduction. (check-in: 8a39167bd2 user: drh tags: trunk)
16:01
Improvements to the LEFT JOIN strength reduction optimization. (check-in: 548082dfab user: drh tags: trunk)
15:33
Ensure fts3/4 prefix indexes are flushed to disk before an 'optimize' command. Fix for [745f1abc]. (check-in: 4ed905b188 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/expr.c.
5227
5228
5229
5230
5231
5232
5233

5234
5235



5236
5237
5238
5239
5240
5241
5242
** clause requires that some column of the right table of the LEFT JOIN
** be non-NULL, then the LEFT JOIN can be safely converted into an
** ordinary join.
*/
int sqlite3ExprImpliesNonNullRow(Expr *p, int iTab){
  Walker w;
  p = sqlite3ExprSkipCollateAndLikely(p);

  if( p && p->op==TK_NOTNULL ){
    p = p->pLeft;



  }
  w.xExprCallback = impliesNotNullRow;
  w.xSelectCallback = 0;
  w.xSelectCallback2 = 0;
  w.eCode = 0;
  w.u.iCur = iTab;
  sqlite3WalkExpr(&w, p);







>
|

>
>
>







5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
** clause requires that some column of the right table of the LEFT JOIN
** be non-NULL, then the LEFT JOIN can be safely converted into an
** ordinary join.
*/
int sqlite3ExprImpliesNonNullRow(Expr *p, int iTab){
  Walker w;
  p = sqlite3ExprSkipCollateAndLikely(p);
  if( p==0 ) return 0;
  if( p->op==TK_NOTNULL ){
    p = p->pLeft;
  }else if( p->op==TK_AND ){
    if( sqlite3ExprImpliesNonNullRow(p->pLeft, iTab) ) return 1;
    p = p->pRight;
  }
  w.xExprCallback = impliesNotNullRow;
  w.xSelectCallback = 0;
  w.xSelectCallback2 = 0;
  w.eCode = 0;
  w.u.iCur = iTab;
  sqlite3WalkExpr(&w, p);