SQLite

Check-in [510f4d8ecf]
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
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.693
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: 7d91f68881 user: drh tags: nextgen-query-plan-exp)
15:07
Set the WHERE_UNIQUE flag on loops that can only run once. (check-in: 510f4d8ecf 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: 9b97af94ae user: drh tags: nextgen-query-plan-exp)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/where.c.
4013
4014
4015
4016
4017
4018
4019






4020
4021
4022
4023
4024
4025
4026
        /* "x IN (value, value, ...)" */
        nIn = pExpr->x.pList->nExpr;
      }
      pNew->u.btree.nEq++;
      pNew->nOut = (double)iRowEst * nInMul * nIn;
    }else if( pTerm->eOperator & (WO_EQ) ){
      pNew->wsFlags |= WHERE_COLUMN_EQ;






      pNew->u.btree.nEq++;
      pNew->nOut = (double)iRowEst * nInMul;
    }else if( pTerm->eOperator & (WO_ISNULL) ){
      pNew->wsFlags |= WHERE_COLUMN_NULL;
      pNew->u.btree.nEq++;
      pNew->nOut = (double)iRowEst * nInMul;
    }else if( pTerm->eOperator & (WO_GT|WO_GE) ){







>
>
>
>
>
>







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