/ Changes On Branch distinct-early-out
Login

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

Changes In Branch distinct-early-out Excluding Merge-Ins

This is equivalent to a diff from 2dcef5a9ae to a33f88acd7

2017-11-23
00:45
Completely disable the skip-ahead-distinct optimization for all but the inner-most loop of a DISTINCT join. Fix for ticket [ef9318757b152e3a26e9592] (check-in: b7595cf2ca user: drh tags: trunk)
2017-11-21
23:47
An experimental optimization to DISTINCT that causes an immediate exit of the inner loop of a join following each output row if the inner loop does not contribute any columns to the result set. (Leaf check-in: a33f88acd7 user: drh tags: distinct-early-out)
23:38
Fix the skip-ahead-distinct optimization on joins for cases there the table in the inner loop of the join does not contribute any columns to the result set. Proposed fix for ticket [ef9318757b152e3a2] (check-in: 2dcef5a9ae user: drh tags: trunk)
21:15
Fix typo in the Makefiles for MSVC. (check-in: 17dd2f7314 user: mistachkin tags: trunk)

Changes to src/where.c.

4943
4944
4945
4946
4947
4948
4949


















4950
4951
4952
4953
4954
4955
4956
  Parse *pParse = pWInfo->pParse;
  Vdbe *v = pParse->pVdbe;
  int i;
  WhereLevel *pLevel;
  WhereLoop *pLoop;
  SrcList *pTabList = pWInfo->pTabList;
  sqlite3 *db = pParse->db;



















  /* Generate loop termination code.
  */
  VdbeModuleComment((v, "End WHERE-core"));
  sqlite3ExprCacheClear(pParse);
  for(i=pWInfo->nLevel-1; i>=0; i--){
    int addr;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
  Parse *pParse = pWInfo->pParse;
  Vdbe *v = pParse->pVdbe;
  int i;
  WhereLevel *pLevel;
  WhereLoop *pLoop;
  SrcList *pTabList = pWInfo->pTabList;
  sqlite3 *db = pParse->db;

  /* For a DISTINCT join in which no columns of inner loops appear in
  ** the result set, put a jump right after the inner loop body that
  ** causes the unused inner loops to exit.
  */
  if( pWInfo->eDistinct==WHERE_DISTINCT_ORDERED
   && pWInfo->nLevel>1
  ){
    Bitmask tabUsed;
    tabUsed = sqlite3WhereExprListUsage(&pWInfo->sMaskSet, pWInfo->pResultSet);
    for(i=pWInfo->nLevel-1; i>=0; i--){
      pLoop = pWInfo->a[i].pWLoop;
      if( (tabUsed & pLoop->maskSelf)!=0 ) break;
    }
    if( i<pWInfo->nLevel-1 ){
      sqlite3VdbeGoto(v, pWInfo->a[i].addrCont);
    }
  }

  /* Generate loop termination code.
  */
  VdbeModuleComment((v, "End WHERE-core"));
  sqlite3ExprCacheClear(pParse);
  for(i=pWInfo->nLevel-1; i>=0; i--){
    int addr;