]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Miscellaneous cleanup of the new Bloom-filter code.
authordrh <>
Sat, 4 Dec 2021 21:11:18 +0000 (21:11 +0000)
committerdrh <>
Sat, 4 Dec 2021 21:11:18 +0000 (21:11 +0000)
FossilOrigin-Name: 201b6dd875b0ae2bbc9969b098e88abfc09e37b59e857decd41f2dcbeeb13e01

manifest
manifest.uuid
src/where.c

index 2c58aedeebe2af1942f52d313d071db96f9a4d6f..e1808eea5b714b97e495d74f621760dd2effacfe 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sVdbeCoverage()\smacros.\s\sAdjust\sthe\sBloom-filter\shash\sfunction\sso\sthat\sit\ncorrectly\sdeals\swith\szero-blobs.
-D 2021-12-04T18:45:08.377
+C Miscellaneous\scleanup\sof\sthe\snew\sBloom-filter\scode.
+D 2021-12-04T21:11:18.037
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -637,7 +637,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
 F src/wal.c ed0398a7adf02c31e34aada42cc86c58f413a7afe5f741a5d373ad087abde028
 F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
 F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b
-F src/where.c 2607f8008b27f03003d62ed3b90e1818fda1dd5727daf020c8b3e526aff57269
+F src/where.c 957543456a7d1683d21ed8c890bcdaa6414716082dfb076bb43decdc0f87909e
 F src/whereInt.h 2c9d149b1b41c59f977deb1882e95632800946fcf15c83eaffb227afece04e51
 F src/wherecode.c 2253f91bcded8932a4211238fa7dcf6ab40ff68dbd4c2d88eb4411f12b19552c
 F src/whereexpr.c 19394cb463003e9cc9305730b1508b8817a22bb7247170d81234b691a7f05b89
@@ -1933,7 +1933,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P a70429596a3c6a413b03118b0d800521b3526d99dcf88a48acc3189b51518d82
-R f0b7f8e349624b23e895cc40d5e34cdd
+P 629ee2e3e3125bfd2af435c6713d49e46691213ad15db0a5e93a63a77f1130c2
+R 5366235cd370e2a6adf5aabc2d25d6ed
 U drh
-Z 186d2bb7a1014e61ff9f3f3c0fb31234
+Z ab3ac181064c99ca5c8ac656f604bf60
index 55275e45b8dbe4d0d349a534ebf07b49b40fcf40..5fe0ded6ae3971c19d3f8ea8aaed9faebef9a6df 100644 (file)
@@ -1 +1 @@
-629ee2e3e3125bfd2af435c6713d49e46691213ad15db0a5e93a63a77f1130c2
\ No newline at end of file
+201b6dd875b0ae2bbc9969b098e88abfc09e37b59e857decd41f2dcbeeb13e01
\ No newline at end of file
index 0d205125c826ae3d9058a97ae5858ca6d58d9b29..c1a538dcc9300a3fbe953357b565218eec0c89f2 100644 (file)
@@ -717,9 +717,9 @@ static void whereTraceIndexInfoOutputs(sqlite3_index_info *p){
 ** index existed.
 */
 static int termCanDriveIndex(
-  WhereTerm *pTerm,              /* WHERE clause term to check */
-  SrcItem *pSrc,                 /* Table we are trying to access */
-  Bitmask notReady               /* Tables in outer loops of the join */
+  const WhereTerm *pTerm,        /* WHERE clause term to check */
+  const SrcItem *pSrc,           /* Table we are trying to access */
+  const Bitmask notReady         /* Tables in outer loops of the join */
 ){
   char aff;
   if( pTerm->leftCursor!=pSrc->iCursor ) return 0;
@@ -752,9 +752,9 @@ static int termCanDriveIndex(
 */
 static SQLITE_NOINLINE void constructAutomaticIndex(
   Parse *pParse,              /* The parsing context */
-  WhereClause *pWC,           /* The WHERE clause */
-  SrcItem *pSrc,              /* The FROM clause term to get the next index */
-  Bitmask notReady,           /* Mask of cursors that are not available */
+  const WhereClause *pWC,     /* The WHERE clause */
+  const SrcItem *pSrc,        /* The FROM clause term to get the next index */
+  const Bitmask notReady,     /* Mask of cursors that are not available */
   WhereLevel *pLevel          /* Write new index here */
 ){
   int nKeyCol;                /* Number of columns in the constructed index */
@@ -969,16 +969,16 @@ end_auto_index_create:
 ** Create a Bloom filter for the WhereLevel in the parameter.
 */
 static SQLITE_NOINLINE void constructBloomFilter(
-  WhereInfo *pWInfo,          /* The WHERE clause */
+  const WhereInfo *pWInfo,    /* The WHERE clause */
   WhereLevel *pLevel          /* Make a Bloom filter for this FROM term */
 ){
   int addrTop;
   int addrCont;
-  WhereTerm *pTerm;
-  WhereTerm *pWCEnd;
+  const WhereTerm *pTerm;
+  const WhereTerm *pWCEnd;
   Parse *pParse = pWInfo->pParse;
   Vdbe *v = pParse->pVdbe;
-  WhereLoop *pLoop = pLevel->pWLoop;
+  const WhereLoop *pLoop = pLevel->pWLoop;
   int iCur;
   
 
@@ -4915,21 +4915,20 @@ static SQLITE_NOINLINE Bitmask whereOmitNoopJoin(
 ** down where the code for each WhereLoop is generated.
 */
 static SQLITE_NOINLINE void whereCheckIfBloomFilterIsUseful(
-  WhereInfo *pWInfo,
-  sqlite3 *db
+  const WhereInfo *pWInfo
 ){
   int i;
   LogEst nSearch;
   SrcItem *pItem;
 
   assert( pWInfo->nLevel>=2 );
-  assert( OptimizationEnabled(db, SQLITE_BloomFilter) );
+  assert( OptimizationEnabled(pWInfo->pParse->db, SQLITE_BloomFilter) );
   nSearch = pWInfo->a[0].pWLoop->nOut;
   for(i=1; i<pWInfo->nLevel; i++){
     WhereLoop *pLoop = pWInfo->a[i].pWLoop;
-    if( (pLoop->wsFlags & (WHERE_IPK|WHERE_INDEXED))!=0
+    if( pLoop->nOut<0
+     && (pLoop->wsFlags & (WHERE_IPK|WHERE_INDEXED))!=0
      && (pLoop->wsFlags & WHERE_COLUMN_EQ)!=0
-     && pLoop->nOut<0
      && nSearch > (pItem = &pWInfo->pTabList->a[pLoop->iTab])->pTab->nRowLogEst
      && (pItem->fg.jointype & JT_LEFT)==0
     ){
@@ -5336,7 +5335,7 @@ WhereInfo *sqlite3WhereBegin(
   if( pWInfo->nLevel>=2
    && OptimizationEnabled(db, SQLITE_BloomFilter)
   ){
-    whereCheckIfBloomFilterIsUseful(pWInfo, db);
+    whereCheckIfBloomFilterIsUseful(pWInfo);
   }
 
 #if defined(WHERETRACE_ENABLED)