aboutsummaryrefslogtreecommitdiff
path: root/src/select.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2012-09-28 00:44:28 +0000
committerdrh <drh@noemail.net>2012-09-28 00:44:28 +0000
commitf784c1ede942139d136f7c00a1d8fb30a4a31f18 (patch)
treeccdfa605d3e6889f40d2af087b833a9eec956584 /src/select.c
parent8ccc6d4076631f3fd97751ce1451453e70c6e329 (diff)
parenta9e3fc05f58a055ffdb67dca2a8215efb698a955 (diff)
downloadsqlite-f784c1ede942139d136f7c00a1d8fb30a4a31f18.tar.gz
sqlite-f784c1ede942139d136f7c00a1d8fb30a4a31f18.zip
Query planner enhancements to be more agressive about optimizing out ORDER BY
clauses - in particular the query planner now has the ability to omit ORDER BY clauses that span multiple tables in a join. FossilOrigin-Name: 1e874629d7cf568368b912b295bd3001147d0b52
Diffstat (limited to 'src/select.c')
-rw-r--r--src/select.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/select.c b/src/select.c
index 01fe27694..2da14d93e 100644
--- a/src/select.c
+++ b/src/select.c
@@ -2809,7 +2809,7 @@ static int flattenSubquery(
*/
assert( p!=0 );
assert( p->pPrior==0 ); /* Unable to flatten compound queries */
- if( db->flags & SQLITE_QueryFlattener ) return 0;
+ if( OptimizationDisabled(db, SQLITE_QueryFlattener) ) return 0;
pSrc = p->pSrc;
assert( pSrc && iFrom>=0 && iFrom<pSrc->nSrc );
pSubitem = &pSrc->a[iFrom];
@@ -4012,7 +4012,7 @@ int sqlite3Select(
** to disable this optimization for testing purposes.
*/
if( sqlite3ExprListCompare(p->pGroupBy, pOrderBy)==0
- && (db->flags & SQLITE_GroupByOrder)==0 ){
+ && OptimizationEnabled(db, SQLITE_GroupByOrder) ){
pOrderBy = 0;
}
@@ -4506,6 +4506,7 @@ int sqlite3Select(
goto select_end;
}
updateAccumulator(pParse, &sAggInfo);
+ assert( pMinMax==0 || pMinMax->nExpr==1 );
if( pWInfo->nOBSat>0 ){
sqlite3VdbeAddOp2(v, OP_Goto, 0, pWInfo->iBreak);
VdbeComment((v, "%s() by index",