/ Check-in [510f4d8e]
Login

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

Overview
Comment:Set the WHERE_UNIQUE flag on loops that can only run once.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | nextgen-query-plan-exp
Files: files | file ages | folders
SHA1: 510f4d8ecf6eb284f14b91951e7236505bd71203
User & Date: drh 2013-06-03 15:07:23
Context
2013-06-03
15:24
Virtual tables now always report 25 rows instead of 0 rows in the EXPLAIN QUERY PLAN output. Adjust tests accordingly. check-in: 7d91f688 user: drh tags: nextgen-query-plan-exp
15:07
Set the WHERE_UNIQUE flag on loops that can only run once. check-in: 510f4d8e user: drh tags: nextgen-query-plan-exp
14:15
Add test cases to verify that ticket [bc1aea7b725f2761] has been fixed in the NGQP. check-in: 9b97af94 user: drh tags: nextgen-query-plan-exp
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

  4013   4013           /* "x IN (value, value, ...)" */
  4014   4014           nIn = pExpr->x.pList->nExpr;
  4015   4015         }
  4016   4016         pNew->u.btree.nEq++;
  4017   4017         pNew->nOut = (double)iRowEst * nInMul * nIn;
  4018   4018       }else if( pTerm->eOperator & (WO_EQ) ){
  4019   4019         pNew->wsFlags |= WHERE_COLUMN_EQ;
         4020  +      if( iCol<0 
         4021  +       || (pProbe->onError==OE_Abort && nInMul==1
         4022  +           && pNew->u.btree.nEq==pProbe->nColumn-1)
         4023  +      ){
         4024  +        pNew->wsFlags |= WHERE_UNIQUE;
         4025  +      }
  4020   4026         pNew->u.btree.nEq++;
  4021   4027         pNew->nOut = (double)iRowEst * nInMul;
  4022   4028       }else if( pTerm->eOperator & (WO_ISNULL) ){
  4023   4029         pNew->wsFlags |= WHERE_COLUMN_NULL;
  4024   4030         pNew->u.btree.nEq++;
  4025   4031         pNew->nOut = (double)iRowEst * nInMul;
  4026   4032       }else if( pTerm->eOperator & (WO_GT|WO_GE) ){