]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Identify indexes that complete cover their table. covering-index
authordrh <drh@noemail.net>
Wed, 24 Feb 2016 15:43:05 +0000 (15:43 +0000)
committerdrh <drh@noemail.net>
Wed, 24 Feb 2016 15:43:05 +0000 (15:43 +0000)
FossilOrigin-Name: 71d488b599cbde817de369efac4412569a55b43d

manifest
manifest.uuid
src/build.c

index 15a208ebd8a880b53abd0e6399fe8c580f0f2a3d..b5ca9ab6dd88347fa5d98a63cfca1d9b0fff0c9e 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sthe\sSQLITE_BITMASK_TYPE\scompile-time\soption.
-D 2016-02-23T16:28:34.108
+C Identify\sindexes\sthat\scomplete\scover\stheir\stable.
+D 2016-02-24T15:43:05.820
 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4
@@ -295,7 +295,7 @@ F src/btmutex.c bc87dd3b062cc26edfe79918de2200ccb8d41e73
 F src/btree.c 7bb920c473c277380fcb3e8a8ee28ce1a48e0abc
 F src/btree.h a5008b9afe56e8e54ade6c436a910f112defcca9
 F src/btreeInt.h c18b7d2a3494695133e4e60ee36061d37f45d9a5
-F src/build.c 88f185a37d1e087818fd7077d84d65c5babefdb1
+F src/build.c 2c85d62e502e3f41f37049733c25be77780660e2
 F src/callback.c 0643b8fb06c95a8977beb201b268210d4b131a22
 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
 F src/ctime.c 60e135af364d777a9ab41c97e5e89cd224da6198
@@ -1429,7 +1429,10 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh a98af506df552f3b3c0d904f94e4cdc4e1a6d598
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P aa9f4c622af191edbeb6a535942944f8c91f5c37
-R 4a575c5637747e2b18640a9618428d3e
+P 0064a8c77b2b048c71277d1cfd1ba3975b513b70
+R 5e33894201e325c17491a9fc46b648e7
+T *branch * covering-index
+T *sym-covering-index *
+T -sym-trunk *
 U drh
-Z c4c6cb390dd2f5f6f2bb80636719a5f7
+Z 47bfdcb1d11cf503d0a7a3e3179c205c
index 561abfe587fd4a149464c04c7b4bbe12b268c550..4694af3ec71d945e015d56f895939769c02cbdc2 100644 (file)
@@ -1 +1 @@
-0064a8c77b2b048c71277d1cfd1ba3975b513b70
\ No newline at end of file
+71d488b599cbde817de369efac4412569a55b43d
\ No newline at end of file
index 13446b790eafa1c96bb96b70ddaa9e390e9c4afc..18b52bd34b837a7e46ed213aaf7e2539f8d45b72 100644 (file)
@@ -3192,6 +3192,17 @@ Index *sqlite3CreateIndex(
   }else{
     pIndex->aiColumn[i] = XN_ROWID;
     pIndex->azColl[i] = sqlite3StrBINARY;
+    /* If this index contains every column of its table, then mark
+    ** it as a covering index */
+    if( pTblName!=0 && pIndex->nColumn>=pTab->nCol ){
+      pIndex->isCovering = 1;
+      for(j=0; j<pTab->nCol; j++){
+        if( j==pTab->iPKey ) continue;
+        if( sqlite3ColumnOfIndex(pIndex,j)>=0 ) continue;
+        pIndex->isCovering = 0;
+        break;
+      }
+    }
   }
   sqlite3DefaultRowEst(pIndex);
   if( pParse->pNewTable==0 ) estimateIndexWidth(pIndex);