From: drh Date: Mon, 3 Jun 2013 15:07:23 +0000 (+0000) Subject: Set the WHERE_UNIQUE flag on loops that can only run once. X-Git-Tag: version-3.8.0~130^2~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=21f7ff7d22ae722ae3955cc61a1020d98b2b959c;p=thirdparty%2Fsqlite.git Set the WHERE_UNIQUE flag on loops that can only run once. FossilOrigin-Name: 510f4d8ecf6eb284f14b91951e7236505bd71203 --- diff --git a/manifest b/manifest index fd53c9cffe..4456115495 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\stest\scases\sto\sverify\sthat\sticket\s[bc1aea7b725f2761]\shas\sbeen\sfixed\sin\nthe\sNGQP. -D 2013-06-03T14:15:34.631 +C Set\sthe\sWHERE_UNIQUE\sflag\son\sloops\sthat\scan\sonly\srun\sonce. +D 2013-06-03T15:07:23.693 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -289,7 +289,7 @@ F src/vtab.c b05e5f1f4902461ba9f5fc49bb7eb7c3a0741a83 F src/wal.c 436bfceb141b9423c45119e68e444358ee0ed35d F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 4fa43583d0a84b48f93b1e88f11adf2065be4e73 -F src/where.c 7c931bf930fcf77d9a446e6d60692ab7a6251d00 +F src/where.c 7e34bb26affb2bf0eee8a8c5ab955cf80e7f9580 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6 @@ -1093,7 +1093,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac -P 42511a7e12a70cf3436d25e4d069e5d309dfd678 -R 9315575e95aec71de6da1203a12a0f54 +P 9b97af94ae7b1624ef1f5adee58010593fbb8b1c +R c10d3b1c9e2b7a04d0ad05024b58cd34 U drh -Z bf9c6fc8107d350958f4a9bdd4f10f03 +Z 86153958e4f1f3df668821cb8ff6a748 diff --git a/manifest.uuid b/manifest.uuid index 824fa2dabf..950d83a47f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9b97af94ae7b1624ef1f5adee58010593fbb8b1c \ No newline at end of file +510f4d8ecf6eb284f14b91951e7236505bd71203 \ No newline at end of file diff --git a/src/where.c b/src/where.c index 4e78f1ebde..1efa409942 100644 --- a/src/where.c +++ b/src/where.c @@ -4017,6 +4017,12 @@ static int whereLoopAddBtreeIndex( 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) ){