SQLite

Check-in [c64fe3a169]
Login

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

Overview
Comment:Futher bug fixes to the function that determines when a materialized view can be reused.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | materialized-view-reuse
Files: files | file ages | folders
SHA3-256: c64fe3a1695925693385d313e9ad2a1d8cb37ddaa8cc19920ae0978c91bc4c2c
User & Date: drh 2017-05-01 17:04:35.162
Context
2017-05-02
17:54
Reuse the same materialization of a view when that view appears in a query more than once, such as in a self-join. (check-in: 9e35c89dbe user: drh tags: trunk)
2017-05-01
17:04
Futher bug fixes to the function that determines when a materialized view can be reused. (Closed-Leaf check-in: c64fe3a169 user: drh tags: materialized-view-reuse)
16:37
Minor bug fixes and performance enhancement. (check-in: b2aae55958 user: drh tags: materialized-view-reuse)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/select.c.
4890
4891
4892
4893
4894
4895
4896
4897






4898
4899
4900
4901
4902
4903
4904
){
  struct SrcList_item *pItem;
  for(pItem = pTabList->a; pItem<pThis; pItem++){
    if( pItem->pSelect==0 ) continue;
    if( pItem->fg.viaCoroutine ) continue;
    if( pItem->zName==0 ) continue;
    if( sqlite3_stricmp(pItem->zDatabase, pThis->zDatabase)!=0 ) continue;
    if( sqlite3_stricmp(pItem->zName, pThis->zName)==0 ) return pItem;






  }
  return 0;
}

/*
** Generate code for the SELECT statement given in the p argument.  
**







|
>
>
>
>
>
>







4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
){
  struct SrcList_item *pItem;
  for(pItem = pTabList->a; pItem<pThis; pItem++){
    if( pItem->pSelect==0 ) continue;
    if( pItem->fg.viaCoroutine ) continue;
    if( pItem->zName==0 ) continue;
    if( sqlite3_stricmp(pItem->zDatabase, pThis->zDatabase)!=0 ) continue;
    if( sqlite3_stricmp(pItem->zName, pThis->zName)!=0 ) continue;
    if( sqlite3ExprCompare(pThis->pSelect->pWhere, pItem->pSelect->pWhere, -1) ){
      /* The view was modified by some other optimization such as
      ** pushDownWhereTerms() */
      continue;
    }
    return pItem;
  }
  return 0;
}

/*
** Generate code for the SELECT statement given in the p argument.  
**