mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-18 10:21:03 +03:00
The early-out of the inner loop on the min/max optimization was overly
aggressive for the cases where there is a join and outer loops contain IN operators. Fix this. Test case in TH3. FossilOrigin-Name: ccd3bae14b6b47bb0f9622700c04db989f76ce65e10e0709964cfd0675eca762
This commit is contained in:
13
src/where.c
13
src/where.c
@@ -112,14 +112,17 @@ int sqlite3WhereOrderByLimitOptLabel(WhereInfo *pWInfo){
|
||||
*/
|
||||
void sqlite3WhereMinMaxOptEarlyOut(Vdbe *v, WhereInfo *pWInfo){
|
||||
WhereLevel *pInner;
|
||||
int i;
|
||||
if( !pWInfo->bOrderedInnerLoop ) return;
|
||||
if( pWInfo->nOBSat==0 ) return;
|
||||
pInner = &pWInfo->a[pWInfo->nLevel-1];
|
||||
if( (pInner->pWLoop->wsFlags & WHERE_COLUMN_IN)==0 ){
|
||||
sqlite3VdbeGoto(v, pWInfo->iBreak);
|
||||
}else if( pInner->addrNxt!=pWInfo->iContinue ){
|
||||
sqlite3VdbeGoto(v, pInner->addrNxt);
|
||||
for(i=pWInfo->nLevel-1; i>=0; i--){
|
||||
pInner = &pWInfo->a[i];
|
||||
if( (pInner->pWLoop->wsFlags & WHERE_COLUMN_IN)!=0 ){
|
||||
sqlite3VdbeGoto(v, pInner->addrNxt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
sqlite3VdbeGoto(v, pWInfo->iBreak);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user