SQLite

Check-in [de08a7e7ab]
Login

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

Overview
Comment:Avoid unnecessary OP_IfNull checks when doing a range query where there is a constraint on the lower bound of the range.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: de08a7e7abbad9b94d0268d096ef4555d31c8b0c
User & Date: drh 2013-11-16 14:03:53.332
Context
2013-11-16
15:35
Fully constraint the ORDER BY on the top-10 line of the --summary output from the wordcount test program. Add the run-wordcount.bash script for running wordcount in various configurations. (check-in: 7edf39eb93 user: drh tags: trunk)
14:03
Avoid unnecessary OP_IfNull checks when doing a range query where there is a constraint on the lower bound of the range. (check-in: de08a7e7ab user: drh tags: trunk)
13:55
Simplification and performance improvement to the logic that factors constant expressions ouf of inner loops. (check-in: ee9353fdf3 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/where.c.
3139
3140
3141
3142
3143
3144
3145

3146
3147
3148
3149
3150
3151
3152
    */
    r1 = sqlite3GetTempReg(pParse);
    testcase( pLoop->wsFlags & WHERE_BTM_LIMIT );
    testcase( pLoop->wsFlags & WHERE_TOP_LIMIT );
    if( (pLoop->wsFlags & (WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0 
     && (j = pIdx->aiColumn[nEq])>=0 
     && pIdx->pTable->aCol[j].notNull==0 

    ){
      sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, nEq, r1);
      VdbeComment((v, "%s", pIdx->pTable->aCol[j].zName));
      sqlite3VdbeAddOp2(v, OP_IsNull, r1, addrCont);
    }
    sqlite3ReleaseTempReg(pParse, r1);








>







3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
    */
    r1 = sqlite3GetTempReg(pParse);
    testcase( pLoop->wsFlags & WHERE_BTM_LIMIT );
    testcase( pLoop->wsFlags & WHERE_TOP_LIMIT );
    if( (pLoop->wsFlags & (WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0 
     && (j = pIdx->aiColumn[nEq])>=0 
     && pIdx->pTable->aCol[j].notNull==0 
     && (nEq || (pLoop->wsFlags & WHERE_BTM_LIMIT)==0)
    ){
      sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, nEq, r1);
      VdbeComment((v, "%s", pIdx->pTable->aCol[j].zName));
      sqlite3VdbeAddOp2(v, OP_IsNull, r1, addrCont);
    }
    sqlite3ReleaseTempReg(pParse, r1);