Small performance improvement in the EXISTS-to-IN translator for the

common case where the EXISTS operator is not found in the WHERE clause.

FossilOrigin-Name: dcb7772d7695ddbc0fe89e06c07ff4a6ae4fa05de914e2ec10b5cc07a62ed49f
This commit is contained in:
drh 2021-01-15 14:25:06 +00:00
parent 19f9cd73ff
commit 10c9ef65fa
3 changed files with 15 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Merge\sthe\slatest\strunk\senhancements\sinto\sthe\sexists-to-in\sbranch.
D 2021-01-15T14:15:31.281
C Small\sperformance\simprovement\sin\sthe\sEXISTS-to-IN\stranslator\sfor\sthe\ncommon\scase\swhere\sthe\sEXISTS\soperator\sis\snot\sfound\sin\sthe\sWHERE\sclause.
D 2021-01-15T14:25:06.079
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -630,7 +630,7 @@ F src/walker.c d9c4e454ebb9499e908aa62d55b8994c375cf5355ac78f60d45af17f7890701c
F src/where.c 0e6abb22a2323fec80b450825593c26a2ad8f4815d1ee3af9969d8f6144bf681
F src/whereInt.h 9a3f577619f07700d16d89eeb2f3d94d6b7ed7f109c2dacf0ce8844921549506
F src/wherecode.c a3a1aff30fe99a818d8e7c607980f033f40c68d890e03ed25838b9dbb7908bee
F src/whereexpr.c 1f4fac8ea8eac6facb9e80107c659094a56a8ad0b35108717ac99ea57bbc71bc
F src/whereexpr.c 0ba5c743ee34255658051179441a13297dc2d6b21ef3c41120659ae3dd896ae8
F src/window.c edd6f5e25a1e8f2b6f5305b7f5f7da7bb35f07f0d432b255b1d4c2fcab4205aa
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867de90627
@ -1896,7 +1896,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 897f3f40267dc922f0fda287484435e1fd8709bade3e87c3829e2f945bb5e4aa 249a71cc6822d6bdd5bb9e727aac81c6549693b418e9c0987b96850ee332c940
R 6fb3b1c5ffde39ec234334a7c5ffcb56
P 13c4c9088cc8a2426e30a2ad1e9b9969407249281c6ed16653d43a0e6852a2e4
R c79f76fc898939a9f2cc931eb9a2c482
U drh
Z 90ae5651a54d924d6159985985e1584c
Z e1fe560394403461c8187fdaaf345432

View File

@ -1 +1 @@
13c4c9088cc8a2426e30a2ad1e9b9969407249281c6ed16653d43a0e6852a2e4
dcb7772d7695ddbc0fe89e06c07ff4a6ae4fa05de914e2ec10b5cc07a62ed49f

View File

@ -1385,6 +1385,14 @@ static void exprAnalyze(
}
#endif /* SQLITE_OMIT_OR_OPTIMIZATION */
else if( pExpr->op==TK_EXISTS ){
/* Perhaps treat an EXISTS operator as an IN operator */
if( (pExpr->flags & EP_VarSelect)!=0 ){
exprAnalyzeExists(pSrc, pWC, idxTerm);
}
}
#ifndef SQLITE_OMIT_LIKE_OPTIMIZATION
/* Add constraints to reduce the search space on a LIKE or GLOB
** operator.
@ -1611,10 +1619,6 @@ static void exprAnalyze(
}
#endif /* SQLITE_ENABLE_STAT4 */
if( pExpr->op==TK_EXISTS && (pExpr->flags & EP_VarSelect) ){
exprAnalyzeExists(pSrc, pWC, idxTerm);
}
/* Prevent ON clause terms of a LEFT JOIN from being used to drive
** an index for tables to the left of the join.
*/