diff options
author | drh <> | 2021-07-15 19:29:43 +0000 |
---|---|---|
committer | drh <> | 2021-07-15 19:29:43 +0000 |
commit | bb301231788a7ca2292005ecf8d924dbf122f2d2 (patch) | |
tree | 14293aa7205fd4473513a252dab25e0e2be0639b /src/window.c | |
parent | 480f5e3e6e70e803b35ddeab947988a89b0163a0 (diff) | |
download | sqlite-bb301231788a7ca2292005ecf8d924dbf122f2d2.tar.gz sqlite-bb301231788a7ca2292005ecf8d924dbf122f2d2.zip |
Attempt to omit ORDER BY clauses from FROM-clause subqueries if those ORDER BY
clauses do not affect the output. See
[forum:/forumpost/2d76f2bcf65d256a|forum thread 2d76f2bcf65d256a] for
discussion. This can help the query flattener in
some cases, resulting in faster query plans. The current implemention does
not always work.
FossilOrigin-Name: ef97c3e7c3ea2cf1a4db6591328fe7ce3f1d189afc2d578159135824ec89e620
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/window.c b/src/window.c index f33c51150..4a05392ad 100644 --- a/src/window.c +++ b/src/window.c @@ -1070,7 +1070,7 @@ int sqlite3WindowRewrite(Parse *pParse, Select *p){ Table *pTab2; p->pSrc->a[0].pSelect = pSub; sqlite3SrcListAssignCursors(pParse, p->pSrc); - pSub->selFlags |= SF_Expanded; + pSub->selFlags |= SF_Expanded|SF_OrderByReqd; pTab2 = sqlite3ResultSetOfSelect(pParse, pSub, SQLITE_AFF_NONE); pSub->selFlags |= (selFlags & SF_Aggregate); if( pTab2==0 ){ |