/ Check-in [51960009]
Login

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

Overview
Comment:Avoid an unnecessary OP_IfNull while doing an indexed search.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:5196000930600d0cd931b87e864507791b9dab08
User & Date: drh 2013-11-13 08:55:02
Context
2013-11-13
17:58
Add the "PRAGMA vdbe_eqp" command, only available with SQLITE_DEBUG. Simplify some of the other debugging logic. check-in: 8ce33f4c user: drh tags: trunk
12:27
Add the ability to use an index even if the left-most columns of the index are unconstrainted, provided that the left-most columns have few distinct values. check-in: 27dd5993 user: drh tags: skip-scan
08:55
Avoid an unnecessary OP_IfNull while doing an indexed search. check-in: 51960009 user: drh tags: trunk
2013-11-12
21:37
Adjust the SQLITE_MALLOCSIZE defines, primarily to make sure _msize gets used with MSVC when appropriate. check-in: 4e7e805e user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

  3112   3112       /* If there are inequality constraints, check that the value
  3113   3113       ** of the table column that the inequality contrains is not NULL.
  3114   3114       ** If it is, jump to the next iteration of the loop.
  3115   3115       */
  3116   3116       r1 = sqlite3GetTempReg(pParse);
  3117   3117       testcase( pLoop->wsFlags & WHERE_BTM_LIMIT );
  3118   3118       testcase( pLoop->wsFlags & WHERE_TOP_LIMIT );
  3119         -    if( (pLoop->wsFlags & (WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0 ){
         3119  +    if( (pLoop->wsFlags & (WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0 
         3120  +     && (j = pIdx->aiColumn[nEq])>=0 
         3121  +     && pIdx->pTable->aCol[j].notNull==0 
         3122  +    ){
  3120   3123         sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, nEq, r1);
         3124  +      VdbeComment((v, "%s", pIdx->pTable->aCol[j].zName));
  3121   3125         sqlite3VdbeAddOp2(v, OP_IsNull, r1, addrCont);
  3122   3126       }
  3123   3127       sqlite3ReleaseTempReg(pParse, r1);
  3124   3128   
  3125   3129       /* Seek the table cursor, if required */
  3126   3130       disableTerm(pLevel, pRangeStart);
  3127   3131       disableTerm(pLevel, pRangeEnd);