]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Performance improvements for whereScan methods.
authordrh <drh@noemail.net>
Mon, 10 Jun 2013 12:34:45 +0000 (12:34 +0000)
committerdrh <drh@noemail.net>
Mon, 10 Jun 2013 12:34:45 +0000 (12:34 +0000)
FossilOrigin-Name: aae14350a37ad50e4607953ab496cba006032873

manifest
manifest.uuid
src/where.c

index 914fd840784ed5ac4dcb9de20b8068aa3d80020d..a55fe673ef2e7dc4273568d6c2b8ee4bfffa6b9c 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sa\shigh-speed\sbypass\sfor\sthe\sNGQP\sfor\sthe\scommon\scase\sof\sa\ssimply\squery\nwith\squality\sconstraints\sthat\soutputs\sa\ssingle\srow.
-D 2013-06-10T12:17:03.683
+C Performance\simprovements\sfor\swhereScan\smethods.
+D 2013-06-10T12:34:45.199
 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 9fff9a5f3f227857aa0590026837a78696d3bba7
+F src/where.c eddcadac3d6d9ec6e969e2d2c9a07c18ee8326c0
 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
@@ -1094,7 +1094,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 dfbca3acaeb862f24f25e7810a16ff2066111ff4 20eeccf1f24dd762f1bee9c3fe628c70ff01627f
-R 1c99bcc201a3fe7c000749ac05c30a32
+P 8d1ba309211e8afa8be5520bbc1eecf6deacae07
+R eb89dcd4fc9448ac2059e0ee34e53951
 U drh
-Z f19cc889e5aa39da8409c75eaebc0bb3
+Z 8ab3224e95cf812319014fdeea79f2dd
index 493af6828644b1908251e2e3bb7d6eb27124ac47..00d4b0108fad3d09958a7e3bd7e5172423443660 100644 (file)
@@ -1 +1 @@
-8d1ba309211e8afa8be5520bbc1eecf6deacae07
\ No newline at end of file
+aae14350a37ad50e4607953ab496cba006032873
\ No newline at end of file
index e6b3c3a53408932e625a2f09a1dbd195daf136ac..37d1b151c851379fd5eabebe8e47ae5d0aebb5f3 100644 (file)
@@ -231,7 +231,6 @@ struct WhereTerm {
 ** terms in the WHERE clause that are useful to the query planner.
 */
 struct WhereScan {
-  WhereTerm *pCurrent;       /* Most recent match */
   WhereClause *pOrigWC;      /* Original, innermost WhereClause */
   WhereClause *pWC;          /* WhereClause currently being scanned */
   char *zCollName;           /* Required collating sequence, if not NULL */
@@ -779,12 +778,13 @@ WhereTerm *whereScanNext(WhereScan *pScan){
   Expr *pX;            /* An expression being tested */
   WhereClause *pWC;    /* Shorthand for pScan->pWC */
   WhereTerm *pTerm;    /* The term being tested */
+  int k = pScan->k;    /* Where to start scanning */
 
   while( pScan->iEquiv<=pScan->nEquiv ){
     iCur = pScan->aEquiv[pScan->iEquiv-2];
     iColumn = pScan->aEquiv[pScan->iEquiv-1];
     while( (pWC = pScan->pWC)!=0 ){
-      for(pTerm=pWC->a+pScan->k; pScan->k<pWC->nTerm; pScan->k++, pTerm++){
+      for(pTerm=pWC->a+k; k<pWC->nTerm; k++, pTerm++){
         if( pTerm->leftCursor==iCur && pTerm->u.leftColumn==iColumn ){
           if( (pTerm->eOperator & WO_EQUIV)!=0
            && pScan->nEquiv<ArraySize(pScan->aEquiv)
@@ -828,20 +828,18 @@ WhereTerm *whereScanNext(WhereScan *pScan){
             ){
               continue;
             }
-            pScan->pCurrent = pTerm;
-            pScan->k++;
+            pScan->k = k+1;
             return pTerm;
           }
         }
       }
       pWC = pScan->pWC = pScan->pWC->pOuter;
-      pScan->k = 0;
+      k = 0;
     }
     pScan->pWC = pScan->pOrigWC;
-    pScan->k = 0;
+    k = 0;
     pScan->iEquiv += 2;
   }
-  pScan->pCurrent = 0;
   return 0;
 }
 
@@ -867,7 +865,6 @@ WhereTerm *whereScanInit(
   int j;
 
   /* memset(pScan, 0, sizeof(*pScan)); */
-  pScan->pCurrent = 0;
   pScan->pOrigWC = pWC;
   pScan->pWC = pWC;
   if( pIdx && iColumn>=0 ){