1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-10-23 21:49:02 +03:00

Minor refinements to the TreeTracker (aka "JoinMiss") optimization.

FossilOrigin-Name: c1ad888eec410613fd5d8ce7e9192bafe4073ad56e87d0232b320b53d5e07120
This commit is contained in:
drh
2026-10-10 12:14:43 +00:00
parent d76e14d85e
commit a32ed5cef2
3 changed files with 18 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
C Add\scomments\sto\shelp\sremind\sdevelopers\sto\skeep\sthe\stable\sof\soptimization\ndisable\sbit\svalues\sin\ssync\swith\sthe\sCLI\sand\swith\sTH3.
D 2026-10-10T00:11:38.969
C Minor\srefinements\sto\sthe\sTreeTracker\s(aka\s"JoinMiss")\soptimization.
D 2026-10-10T12:14:43.652
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -885,7 +885,7 @@ F src/wal.h c6251cfc1950643a976625ca452e46dc9b466b4f5dd2e85f244f29f79bf68ace
F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014
F src/where.c 68350b0498125555d715c40a6ac1472ac9afb1a910d328b27757afb631cc6a0e
F src/whereInt.h 5d739acb94bf1fdf6edd502a919e3dcf2d340dda63cc1827304e119ea878f6f3
F src/wherecode.c 057bbc97072eb69835ae4555de13f9262da998229e1c6682769f336ea377ce2a
F src/wherecode.c a49e12c4d8e24f231d16e94ad7953a39533433bed794047d8d328a36f5fae3b1
F src/whereexpr.c 76f72a95c5cf0e8a8edb679ca4fb7afa17ba45ff4effe73c414266510109e701
F src/window.c 79a17de595e62aa45961ef1cbe3392e7ebae69fdde3fd0b0200254bc4647025e
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
@@ -2280,8 +2280,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
P 77278079d9dddaff30a1862bf412329e91242a41be7eafc19d3fac8d872adeff
R 224c82c7380fb36f0b5af9a996090a94
P 0e707e7dba7edadda9951549ae3aa34b713a0f2210ccc486e181e833c74e2fa6
R e723081299e4a5ad576ea1133576fbb1
U drh
Z 36d1658b412bbe9570138470412f6227
Z 87720fc95c4150289313a5d057eb4075
# Remove this line to create a well-formed Fossil manifest.

View File

@@ -1 +1 @@
0e707e7dba7edadda9951549ae3aa34b713a0f2210ccc486e181e833c74e2fa6
c1ad888eec410613fd5d8ce7e9192bafe4073ad56e87d0232b320b53d5e07120

View File

@@ -1565,22 +1565,17 @@ static int findNoMatchContinuation(
/* If there are less than two outer loops, this optimization is no help */
return 0;
}
if( OptimizationDisabled(pWInfo->pParse->db, SQLITE_JoinMiss) ){
return 0;
}
/* The OP_SeekGE and OP_SeekLE opcodes only work right for this
** optimization on a pure equality constraint, so skip the optimization
** for anything else.
*/
pLoop = pWInfo->a[iLevel].pWLoop;
#if 1
if( (pLoop->wsFlags & WHERE_CONSTRAINT)!=WHERE_COLUMN_EQ ) return 0;
if( pLoop->wsFlags & WHERE_SKIPSCAN ) return 0;
if( pLoop->wsFlags & WHERE_BIGNULL_SORT ) return 0;
assert( (pLoop->wsFlags & (WHERE_VIRTUALTABLE|WHERE_MULTI_OR))==0 );
assert( pLoop->u.btree.nEq>0 );
#endif
/* Find a mask of all outer tables that influence the key. At the same
** time, check to see if any keys values are computed from subqueries and
@@ -1610,10 +1605,17 @@ static int findNoMatchContinuation(
if( pTabList->a[pWInfo->a[i].iFrom].fg.jointype & JT_OUTER ) return 0;
}
/* If we reach this point, that means the conditions of the optimization
** have been met. Even so, disallow the optimization if it is disabled.
*/
if( OptimizationDisabled(pWInfo->pParse->db, SQLITE_JoinMiss) ){
return 0;
}
/* If the inner-most outer loop that influences the key for iLevel
** is controlled by an automatic index and if it is the only outer
** loop that influences the key, then arrange to delete the automatic
** index entry if there is no match on the iLevel key.
** is controlled by an automatic index and if the automatic index is
** the only outer loop that influences the key, then arrange to delete
** the automatic index entry if there is no match on the key.
*/
pParent = &pWInfo->a[iParent];
if( (pParent->pWLoop->wsFlags & WHERE_AUTO_INDEX)!=0
@@ -1625,6 +1627,7 @@ static int findNoMatchContinuation(
return pParent->addrDeleteCont;
}
testcase( iParent<iLevel-1 );
return pParent->addrCont;
}