diff options
author | drh <drh@noemail.net> | 2013-03-27 16:42:21 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2013-03-27 16:42:21 +0000 |
commit | e6a8bbbb623169b08390c0db0d52e8ad07653ae6 (patch) | |
tree | 99388fae4ed2c38894dc40a58456ea43e4880d3c /src | |
parent | 2b6c874b13b649ce31eb8907ec1faa261536a2bf (diff) | |
download | sqlite-e6a8bbbb623169b08390c0db0d52e8ad07653ae6.tar.gz sqlite-e6a8bbbb623169b08390c0db0d52e8ad07653ae6.zip |
Restore additional ORDER BY optimizations that where broken by the
recent ORDER BY fix.
FossilOrigin-Name: c77ee6e20d3a8c91a8bf4c9063c36a95c70e17cf
Diffstat (limited to 'src')
-rw-r--r-- | src/where.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/where.c b/src/where.c index 409d73a05..5c0f664ae 100644 --- a/src/where.c +++ b/src/where.c @@ -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 ); |