mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Attempt the [/info/f4229707ac08d66c|constant propagation optimization] on any
WHERE clause that has a top-level AND operator, even if the query is not a join. This is an attempt to partially address the concern raised in [forum:/forumpost/830d37b928|forum post 830d37b928]. FossilOrigin-Name: e994c9f29f7a561dd5f30573865b0f793fb1388af09a2afb9b1a5b037ea52f89
This commit is contained in:
@@ -4469,7 +4469,7 @@ static void constInsert(
|
||||
*/
|
||||
static void findConstInWhere(WhereConst *pConst, Expr *pExpr){
|
||||
Expr *pRight, *pLeft;
|
||||
if( pExpr==0 ) return;
|
||||
if( NEVER(pExpr==0) ) return;
|
||||
if( ExprHasProperty(pExpr, EP_FromJoin) ) return;
|
||||
if( pExpr->op==TK_AND ){
|
||||
findConstInWhere(pConst, pExpr->pRight);
|
||||
@@ -6328,7 +6328,8 @@ int sqlite3Select(
|
||||
** as the equivalent optimization will be handled by query planner in
|
||||
** sqlite3WhereBegin().
|
||||
*/
|
||||
if( pTabList->nSrc>1
|
||||
if( p->pWhere!=0
|
||||
&& p->pWhere->op==TK_AND
|
||||
&& OptimizationEnabled(db, SQLITE_PropagateConst)
|
||||
&& propagateConstants(pParse, p)
|
||||
){
|
||||
|
||||
Reference in New Issue
Block a user