]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Minor problems in the high-speed NGQP fixed. nextgen-query-plan-fast
authordrh <drh@noemail.net>
Mon, 10 Jun 2013 12:15:47 +0000 (12:15 +0000)
committerdrh <drh@noemail.net>
Mon, 10 Jun 2013 12:15:47 +0000 (12:15 +0000)
FossilOrigin-Name: 20eeccf1f24dd762f1bee9c3fe628c70ff01627f

manifest
manifest.uuid
src/where.c

index 39d6b5106409436676754d82407c4f6c2f83e9a2..7682ff8ad25a427e0d812653d510a88288f3b24a 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C High-speed\sversion\sof\sNGQP.\s\sStill\shas\ssome\sminor\sproblems.
-D 2013-06-09T17:21:25.979
+C Minor\sproblems\sin\sthe\shigh-speed\sNGQP\sfixed.
+D 2013-06-10T12:15:47.024
 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 2dae18fe0b79aa90f213c5f2ff385a7ac56d36d5
+F src/where.c 9fff9a5f3f227857aa0590026837a78696d3bba7
 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
@@ -1094,10 +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
-R e3ea6bb6c8cd62c47ea6f6e83f99515a
-T *branch * nextgen-query-plan-fast
-T *sym-nextgen-query-plan-fast *
-T -sym-nextgen-query-plan-exp *
+P db2415fa677b84cd0f6dd424283c94e98d246e3b
+R 1c99bcc201a3fe7c000749ac05c30a32
 U drh
-Z 13597db4c2da76541af04a4f735ffed4
+Z f1d76f2fd1cf61ecde305cf79590397b
index 3a88e7286011a6060ee853d9b83e552b99f6a928..6bd8b33dc7f1dabc6875d25933018e417a83e690 100644 (file)
@@ -1 +1 @@
-db2415fa677b84cd0f6dd424283c94e98d246e3b
\ No newline at end of file
+20eeccf1f24dd762f1bee9c3fe628c70ff01627f
\ No newline at end of file
index 135633e1cf4cc9f2c5d6ad1207f5c4a5bebd128c..e6b3c3a53408932e625a2f09a1dbd195daf136ac 100644 (file)
@@ -4281,6 +4281,21 @@ static int indexMightHelpWithOrderBy(
   return 0;
 }
 
+/*
+** Return a bitmask where 1s indicate that the corresponding column of
+** the table is used by an index.  Only the first 63 columns are considered.
+*/
+static Bitmask columnsUsedByIndex(Index *pIdx){
+  Bitmask m = 0;
+  int j;
+  for(j=pIdx->nColumn-1; j>=0; j--){
+    int x = pIdx->aiColumn[j];
+    if( x<BMS-1 ) m |= MASKBIT(x);
+  }
+  return m;
+}
+
+
 /*
 ** Add all WhereLoop objects a single table of the join were the table
 ** is idenfied by pBuilder->pNew->iTab.  That table is guaranteed to be
@@ -4388,14 +4403,7 @@ static int whereLoopAddBtree(
       rc = whereLoopInsert(pBuilder, pNew);
       if( rc ) break;
     }else{
-      Bitmask m = pSrc->colUsed;
-      int j;
-      for(j=pProbe->nColumn-1; j>=0; j--){
-        int x = pProbe->aiColumn[j];
-        if( x<BMS-1 ){
-          m &= ~MASKBIT(x);
-        }
-      }
+      Bitmask m = pSrc->colUsed & ~columnsUsedByIndex(pProbe);
       pNew->wsFlags = (m==0) ? (WHERE_IDX_ONLY|WHERE_INDEXED) : WHERE_INDEXED;
 
       /* Full scan via index */
@@ -5186,7 +5194,7 @@ static int whereSimpleFastCase(WhereLoopBuilder *pBuilder){
   WhereTerm *pTerm;
   WhereLoop *pLoop;
   int iCur;
-  int i, j;
+  int j;
   int nOrderBy;
   Table *pTab;
   Index *pIdx;
@@ -5202,6 +5210,11 @@ static int whereSimpleFastCase(WhereLoopBuilder *pBuilder){
   pLoop = pBuilder->pNew;
   pWInfo->a[0].pWLoop = pLoop;
   pLoop->wsFlags = 0;
+  pLoop->maskSelf = getMask(&pWInfo->sMaskSet, iCur);
+  pWInfo->a[0].iTabCur = iCur;
+#ifdef SQLITE_DEBUG
+  pLoop->cId = '0';
+#endif
   nOrderBy = pWInfo->pOrderBy ? pWInfo->pOrderBy->nExpr : 0;
   pTerm = findTerm(pWC, iCur, -1, 1, WO_EQ, 0);
   if( pTerm ){
@@ -5223,7 +5236,10 @@ static int whereSimpleFastCase(WhereLoopBuilder *pBuilder){
         pLoop->aLTerm[j] = pTerm;
       }
       if( j!=pIdx->nColumn ) continue;
-      pLoop->wsFlags = WHERE_COLUMN_EQ|WHERE_ONEROW;
+      pLoop->wsFlags = WHERE_COLUMN_EQ|WHERE_ONEROW|WHERE_INDEXED;
+      if( (pItem->colUsed & ~columnsUsedByIndex(pIdx))==0 ){
+        pLoop->wsFlags |= WHERE_IDX_ONLY;
+      }
       pLoop->nLTerm = j;
       pLoop->u.btree.nEq = j;
       pLoop->u.btree.pIndex = pIdx;