1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-16 23:02:26 +03:00

Miscellaneous cleanup of the new Bloom-filter code.

FossilOrigin-Name: 201b6dd875b0ae2bbc9969b098e88abfc09e37b59e857decd41f2dcbeeb13e01
This commit is contained in:
drh
2021-12-04 21:11:18 +00:00
parent 067c60cfc9
commit fecbf0a179
3 changed files with 22 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
C Add\sVdbeCoverage()\smacros.\s\sAdjust\sthe\sBloom-filter\shash\sfunction\sso\sthat\sit\ncorrectly\sdeals\swith\szero-blobs. C Miscellaneous\scleanup\sof\sthe\snew\sBloom-filter\scode.
D 2021-12-04T18:45:08.377 D 2021-12-04T21:11:18.037
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -637,7 +637,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c ed0398a7adf02c31e34aada42cc86c58f413a7afe5f741a5d373ad087abde028 F src/wal.c ed0398a7adf02c31e34aada42cc86c58f413a7afe5f741a5d373ad087abde028
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b
F src/where.c 2607f8008b27f03003d62ed3b90e1818fda1dd5727daf020c8b3e526aff57269 F src/where.c 957543456a7d1683d21ed8c890bcdaa6414716082dfb076bb43decdc0f87909e
F src/whereInt.h 2c9d149b1b41c59f977deb1882e95632800946fcf15c83eaffb227afece04e51 F src/whereInt.h 2c9d149b1b41c59f977deb1882e95632800946fcf15c83eaffb227afece04e51
F src/wherecode.c 2253f91bcded8932a4211238fa7dcf6ab40ff68dbd4c2d88eb4411f12b19552c F src/wherecode.c 2253f91bcded8932a4211238fa7dcf6ab40ff68dbd4c2d88eb4411f12b19552c
F src/whereexpr.c 19394cb463003e9cc9305730b1508b8817a22bb7247170d81234b691a7f05b89 F src/whereexpr.c 19394cb463003e9cc9305730b1508b8817a22bb7247170d81234b691a7f05b89
@@ -1933,7 +1933,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P a70429596a3c6a413b03118b0d800521b3526d99dcf88a48acc3189b51518d82 P 629ee2e3e3125bfd2af435c6713d49e46691213ad15db0a5e93a63a77f1130c2
R f0b7f8e349624b23e895cc40d5e34cdd R 5366235cd370e2a6adf5aabc2d25d6ed
U drh U drh
Z 186d2bb7a1014e61ff9f3f3c0fb31234 Z ab3ac181064c99ca5c8ac656f604bf60

View File

@@ -1 +1 @@
629ee2e3e3125bfd2af435c6713d49e46691213ad15db0a5e93a63a77f1130c2 201b6dd875b0ae2bbc9969b098e88abfc09e37b59e857decd41f2dcbeeb13e01

View File

@@ -717,9 +717,9 @@ static void whereTraceIndexInfoOutputs(sqlite3_index_info *p){
** index existed. ** index existed.
*/ */
static int termCanDriveIndex( static int termCanDriveIndex(
WhereTerm *pTerm, /* WHERE clause term to check */ const WhereTerm *pTerm, /* WHERE clause term to check */
SrcItem *pSrc, /* Table we are trying to access */ const SrcItem *pSrc, /* Table we are trying to access */
Bitmask notReady /* Tables in outer loops of the join */ const Bitmask notReady /* Tables in outer loops of the join */
){ ){
char aff; char aff;
if( pTerm->leftCursor!=pSrc->iCursor ) return 0; if( pTerm->leftCursor!=pSrc->iCursor ) return 0;
@@ -752,9 +752,9 @@ static int termCanDriveIndex(
*/ */
static SQLITE_NOINLINE void constructAutomaticIndex( static SQLITE_NOINLINE void constructAutomaticIndex(
Parse *pParse, /* The parsing context */ Parse *pParse, /* The parsing context */
WhereClause *pWC, /* The WHERE clause */ const WhereClause *pWC, /* The WHERE clause */
SrcItem *pSrc, /* The FROM clause term to get the next index */ const SrcItem *pSrc, /* The FROM clause term to get the next index */
Bitmask notReady, /* Mask of cursors that are not available */ const Bitmask notReady, /* Mask of cursors that are not available */
WhereLevel *pLevel /* Write new index here */ WhereLevel *pLevel /* Write new index here */
){ ){
int nKeyCol; /* Number of columns in the constructed index */ 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. ** Create a Bloom filter for the WhereLevel in the parameter.
*/ */
static SQLITE_NOINLINE void constructBloomFilter( 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 */ WhereLevel *pLevel /* Make a Bloom filter for this FROM term */
){ ){
int addrTop; int addrTop;
int addrCont; int addrCont;
WhereTerm *pTerm; const WhereTerm *pTerm;
WhereTerm *pWCEnd; const WhereTerm *pWCEnd;
Parse *pParse = pWInfo->pParse; Parse *pParse = pWInfo->pParse;
Vdbe *v = pParse->pVdbe; Vdbe *v = pParse->pVdbe;
WhereLoop *pLoop = pLevel->pWLoop; const WhereLoop *pLoop = pLevel->pWLoop;
int iCur; int iCur;
@@ -4915,21 +4915,20 @@ static SQLITE_NOINLINE Bitmask whereOmitNoopJoin(
** down where the code for each WhereLoop is generated. ** down where the code for each WhereLoop is generated.
*/ */
static SQLITE_NOINLINE void whereCheckIfBloomFilterIsUseful( static SQLITE_NOINLINE void whereCheckIfBloomFilterIsUseful(
WhereInfo *pWInfo, const WhereInfo *pWInfo
sqlite3 *db
){ ){
int i; int i;
LogEst nSearch; LogEst nSearch;
SrcItem *pItem; SrcItem *pItem;
assert( pWInfo->nLevel>=2 ); assert( pWInfo->nLevel>=2 );
assert( OptimizationEnabled(db, SQLITE_BloomFilter) ); assert( OptimizationEnabled(pWInfo->pParse->db, SQLITE_BloomFilter) );
nSearch = pWInfo->a[0].pWLoop->nOut; nSearch = pWInfo->a[0].pWLoop->nOut;
for(i=1; i<pWInfo->nLevel; i++){ for(i=1; i<pWInfo->nLevel; i++){
WhereLoop *pLoop = pWInfo->a[i].pWLoop; 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->wsFlags & WHERE_COLUMN_EQ)!=0
&& pLoop->nOut<0
&& nSearch > (pItem = &pWInfo->pTabList->a[pLoop->iTab])->pTab->nRowLogEst && nSearch > (pItem = &pWInfo->pTabList->a[pLoop->iTab])->pTab->nRowLogEst
&& (pItem->fg.jointype & JT_LEFT)==0 && (pItem->fg.jointype & JT_LEFT)==0
){ ){
@@ -5336,7 +5335,7 @@ WhereInfo *sqlite3WhereBegin(
if( pWInfo->nLevel>=2 if( pWInfo->nLevel>=2
&& OptimizationEnabled(db, SQLITE_BloomFilter) && OptimizationEnabled(db, SQLITE_BloomFilter)
){ ){
whereCheckIfBloomFilterIsUseful(pWInfo, db); whereCheckIfBloomFilterIsUseful(pWInfo);
} }
#if defined(WHERETRACE_ENABLED) #if defined(WHERETRACE_ENABLED)