mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Optimization for "SELECT min(x) FROM tbl" where "x" is indexed and NOT NULL. This also allows similar queries on NOT NULL virtual table columns to be optimized.
FossilOrigin-Name: 59726777934e201d94e99ca693f0fda4ebfb1c7883d0258ce542f63f9924c28c
This commit is contained in:
@@ -4477,7 +4477,9 @@ static u8 minMaxQuery(sqlite3 *db, Expr *pFunc, ExprList **ppMinMax){
|
||||
zFunc = pFunc->u.zToken;
|
||||
if( sqlite3StrICmp(zFunc, "min")==0 ){
|
||||
eRet = WHERE_ORDERBY_MIN;
|
||||
sortFlags = KEYINFO_ORDER_BIGNULL;
|
||||
if( sqlite3ExprCanBeNull(pEList->a[0].pExpr) ){
|
||||
sortFlags = KEYINFO_ORDER_BIGNULL;
|
||||
}
|
||||
}else if( sqlite3StrICmp(zFunc, "max")==0 ){
|
||||
eRet = WHERE_ORDERBY_MAX;
|
||||
sortFlags = KEYINFO_ORDER_DESC;
|
||||
|
||||
Reference in New Issue
Block a user