From: drh Date: Thu, 12 Nov 2009 04:26:39 +0000 (+0000) Subject: Suppress unnecessary OP_Noop instructions on when the right table of a X-Git-Tag: fts3-refactor~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=35451c6acdd9127bb7ab1d20862ad77e492fc1ed;p=thirdparty%2Fsqlite.git Suppress unnecessary OP_Noop instructions on when the right table of a LEFT JOIN uses the index-only optimization. FossilOrigin-Name: e8aec08bee1c8d593474561898037aed571e64ce --- diff --git a/manifest b/manifest index 53303daffc..b89db16a5d 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Suppress\sexcess\sOP_Null\sopcodes\scaused\sby\sbinary\sIS\sor\sIS\sNOT\soperators\s\nthat\sare\sconverted\sinto\sunary\sISNULL\sor\sNOTNULL\soperators. -D 2009-11-12T03:46:34 +C Suppress\sunnecessary\sOP_Noop\sinstructions\son\swhen\sthe\sright\stable\sof\sa\s\nLEFT\sJOIN\suses\sthe\sindex-only\soptimization. +D 2009-11-12T04:26:39 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 53f3dfa49f28ab5b80cb083fb7c9051e596bcfa1 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -219,7 +219,7 @@ F src/vdbeblob.c 84f924700a7a889152aeebef77ca5f4e3875ffb4 F src/vdbemem.c 1e16e3a16e55f4c3452834f0e041726021aa66e0 F src/vtab.c 456fc226614569f0e46f216e33265bea268bd917 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f -F src/where.c 29d3324010a1f8a5e92372dc7b544405bf319e30 +F src/where.c c4ef49803cced21b9387381b5b71aaf98c4b8103 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 14165b3e32715b700b5f0cbf8f6e3833dda0be45 @@ -770,14 +770,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 39d5b292d27faf00ab58ff4074f91f7aea97cd99 -R c19d84dba79b3abd8970106821a4d05d +P cff1b36ab2c417611f59e96694005c03762788d2 +R 27ea3cc9eb26b161a34ebbe34741190e U drh -Z 3cbf107f89243c15e854c8e3cdc20f73 +Z 1781a9afcc14917ad21934e90b64a6d9 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFK+4UeoxKgR168RlERAoVfAJ9p0PXyLRWA76+9khL8SSrXAwEe8gCeOt0X -3oLu7ZH/IfhZcimL477cDUs= -=cbgv +iD8DBQFK+46CoxKgR168RlERAs2eAJ9q+CJ0pBp0WyIBy8gQXLRefcg5DACdH31c +P01a4JtLngUfv/eThlehXws= +=kK2G -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index f007b77be6..af79f3e452 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cff1b36ab2c417611f59e96694005c03762788d2 \ No newline at end of file +e8aec08bee1c8d593474561898037aed571e64ce \ No newline at end of file diff --git a/src/where.c b/src/where.c index 56f0ace604..135ff80023 100644 --- a/src/where.c +++ b/src/where.c @@ -3944,7 +3944,11 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){ if( pLevel->iLeftJoin ){ int addr; addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin); - sqlite3VdbeAddOp1(v, OP_NullRow, pTabList->a[i].iCursor); + assert( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0 + || (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 ); + if( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0 ){ + sqlite3VdbeAddOp1(v, OP_NullRow, pTabList->a[i].iCursor); + } if( pLevel->iIdxCur>=0 ){ sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iIdxCur); } @@ -3995,7 +3999,6 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){ int k, j, last; VdbeOp *pOp; Index *pIdx = pLevel->plan.u.pIdx; - int useIndexOnly = pLevel->plan.wsFlags & WHERE_IDX_ONLY; assert( pIdx!=0 ); pOp = sqlite3VdbeGetOp(v, pWInfo->iTop); @@ -4010,12 +4013,11 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){ break; } } - assert(!useIndexOnly || jnColumn); + assert( (pLevel->plan.wsFlags & WHERE_IDX_ONLY)==0 + || jnColumn ); }else if( pOp->opcode==OP_Rowid ){ pOp->p1 = pLevel->iIdxCur; pOp->opcode = OP_IdxRowid; - }else if( pOp->opcode==OP_NullRow && useIndexOnly ){ - pOp->opcode = OP_Noop; } } }