1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-21 09:00:59 +03:00

Restore additional ORDER BY optimizations that where broken by the

recent ORDER BY fix.

FossilOrigin-Name: c77ee6e20d3a8c91a8bf4c9063c36a95c70e17cf
This commit is contained in:
drh
2013-03-27 16:42:21 +00:00
parent 2b6c874b13
commit e6a8bbbb62
3 changed files with 12 additions and 9 deletions

View File

@@ -2927,8 +2927,9 @@ static int isSortingIndex(
nPriorSat = 0;
outerObUnique = 1;
}else{
u32 wsFlags = p->aLevel[p->i-1].plan.wsFlags;
nPriorSat = p->aLevel[p->i-1].plan.nOBSat;
if( (p->aLevel[p->i-1].plan.wsFlags & WHERE_ORDERED)==0 ){
if( (wsFlags & WHERE_ORDERED)==0 ){
/* This loop cannot be ordered unless the next outer loop is
** also ordered */
return nPriorSat;
@@ -2938,7 +2939,9 @@ static int isSortingIndex(
** optimization is disabled */
return nPriorSat;
}
outerObUnique = (p->aLevel[p->i-1].plan.wsFlags & WHERE_OB_UNIQUE)!=0;
testcase( wsFlags & WHERE_OB_UNIQUE );
testcase( wsFlags & WHERE_ALL_UNIQUE );
outerObUnique = (wsFlags & (WHERE_OB_UNIQUE|WHERE_ALL_UNIQUE))!=0;
}
pOrderBy = p->pOrderBy;
assert( pOrderBy!=0 );